WWW::MenuGrinder::Plugin::Variables - WWW::MenuGrinder plugin that does variable substitutions and checks.
version 0.06
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.
WWW::MenuGrinder::Plugin::Variables
WWW::MenuGrinder
plugins
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).
need_var
no_var
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".
"Hello, ${object}!"
"Hello, world!"
object
"world"
substitute_fields
An arrayref containing the names of menu keys to perform variable substitution on. Defaults to ['label'].
['label']
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.
get_variable
${}
Andrew Rodland <andrew@hbslabs.com>
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.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
To install WWW::MenuGrinder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::MenuGrinder
CPAN shell
perl -MCPAN -e shell install WWW::MenuGrinder
For more information on module installation, please visit the detailed CPAN module installation guide.