Andrew Rodland
and 1 contributors


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.

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".


  • substitute_fields

    An arrayref containing the names of menu keys to perform variable substitution on. Defaults to ['label'].

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.


Andrew Rodland <>


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:

Around line 108:

You forgot a '=back' before '=head2'