NAME
Dancer2::Plugin::Menu - Automatically generate an HTML menu for your Dancer2 app
VERSION
version 0.002
KEYWORDS
menu_item( { [title => $str], [weight => $num] }, ROUTE METHOD
REGEXP
, CODE
)
Wraps a conventional route handler preceded by a required hash reference containing data that will be applied to the route's endpoint.
Two keys can be supplied in the hash reference: a title
for the menu item and a weight. The title will be used as the content for the menu items. The weight will determine the order of the menu items. Heavier items (with larger values) will "sink" to the bottom compared to sibling menu items sharing the same level within the hierarchy. If two sibling menu items have the same weight, the menu items will be ordered alphabetically.
Menu items that are not endpoints in the route or that are not supplied with a title, will have a title automatically generated according to their segment name. For example, this route:
/categories/fun food/desserts
Will be converted to a hierachy of menu items entitled Categories
, Fun food
, and Desserts
. Note that captialization is automatically added. Automatic titles will be overridden with endpoint specific titles if they are supplied later in the app.
If no weight is supplied it will default to a value of 5
.
REQUIRES
SUPPORT
Perldoc
You can find documentation for this module with the perldoc command.
perldoc Dancer2::Plugin::Menu
Websites
The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
https://github.com/sdondley/Dancer2-Plugin-Menu
git clone git://github.com/sdondley/Dancer2-Plugin-Menu.git
BUGS AND LIMITATIONS
You can make new bug reports, and view existing ones, through the web interface at https://github.com/sdondley/Dancer2-Plugin-Menu/issues.
INSTALLATION
See perlmodinstall for information and options on installing Perl modules.
AUTHOR
Steve Dondley <s@dondley.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2018 by Steve Dondley.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.