Skip to content

Instantly share code, notes, and snippets.

@gabrielmad
Created August 9, 2014 13:33
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 gabrielmad/741d778ad2e576582eb4 to your computer and use it in GitHub Desktop.
Save gabrielmad/741d778ad2e576582eb4 to your computer and use it in GitHub Desktop.
package MyApp::Plugin::TooCool;
use Moo;
sub get_something {
my ($self, $c, $default) = @_;
return $c->param('something') || $default || 'could not find something';
}
sub register {
my ($self, $app, $config) = @_;
$app->helper( $self => 'too_cool' );
}
#============================================================================
package MyApp::Controller::User;
sub some_action {
my $c = shift;
$c->render(text => $c->too_cool->get_something(123));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment