Skip to content

Instantly share code, notes, and snippets.

@tempire
Created August 7, 2014 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tempire/c4a4df70f7ed0d9b48bc to your computer and use it in GitHub Desktop.
Save tempire/c4a4df70f7ed0d9b48bc to your computer and use it in GitHub Desktop.
Helper namespaces
# Usage:
$c->something->whatever;
# Define:
helper(something => sub {
my $c = shift;
state $something = Something->new;
$something->controller($c);
});
package HelperNamespace;
use Mojo::Base -base;
has 'controller';
sub whatever { ... }
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment