Mojolicious::Plugin::NamedHelpers - Mojolicious Plugin
# Mojolicious $self->plugin('NamedHelpers'); $self->named_helper( my_little_helper => sub { ... } ); # Mojolicious::Lite plugin 'NamedHelpers'; # Mojolicious::Lite - with custom namespace plugin 'NamedHelpers' => { namespace => 'My::App::Helpers' };
Mojolicious::Plugin::NamedHelpers is a Mojolicious plugin that sets a fully qualified name to anonymous helper subs using a tiny wrapper upon helper creation. Without this plugin those subs will be named __ANON__, but now they will be named after the helper.
By default the namespace will be the same as the app, but this can be overridden if desired.
The author's use-case is for providing more context in JSON-based application logs, where all helpers would identidy themselves as __ANON__.
This plugin provides a new helper called "named_helper".
By registering your helpers with "named_helper" the name of the sub will be set equal to the name of the helper.
This module is written by Vidar Tyldum, but withcrucial help from the #mojo IRC channel on irc.perl.org.
Sub::Util>, Mojolicious, Mojolicious::Guides, http://mojolicious.org.
To install Mojolicious::Plugin::NamedHelpers, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::NamedHelpers
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::NamedHelpers
For more information on module installation, please visit the detailed CPAN module installation guide.