Andrew Rodland > WWW-MenuGrinder-0.06 > WWW::MenuGrinder::Plugin::Variables

Download:
WWW-MenuGrinder-0.06.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.06   Source  

NAME ^

WWW::MenuGrinder::Plugin::Variables - WWW::MenuGrinder plugin that does variable substitutions and checks.

VERSION ^

version 0.06

DESCRIPTION ^

WWW::MenuGrinder::Plugin::Variables is a plugin for WWW::MenuGrinder. You should not use it directly, but include it in the plugins section of a WWW::MenuGrinder config.

When loaded, this plugin will interpolate named variables into menu fields from the application context. It will also remove any item containing a need_var key naming a variable that does exist (and all of that item's descendents), as well as any item containing a no_var key naming a variable that does exist (and all of that item's descendents).

The variable interpolation syntax is akin to Perl's, except that curly braces are mandatory. For example, the string "Hello, ${object}!" becomes "Hello, world!" if the variable object holds the value "world".

Configuration

Required Methods

In order to load this plugin your WWW::MenuGrinder subclass must implement the method get_variable accepting a variable name (without ${}) and returning the value of that variable, or undef if the variable does not exist or is not set. Existence and definedness are not distinguished. The source of "variables" is left entirely to the implementer, but might be the stash, the session, the application configuration, or some combination.

AUTHOR ^

Andrew Rodland <andrew@hbslabs.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2011 by HBS Labs, LLC..

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: