Gapp::App::Role::HasHooks - Role for app with hooks
package Foo::App; use Moose; extends 'Gapp::App'; with 'Gapp::App::Role::HasHooks'; sub BUILD { ( $self ) = @_; $self->register_hook('init'); } sub init { $self->call_hook('init'); } ... package main; $app = Foo::App->new; $app->hook( 'init', sub { print 'Hello world!' } ); $app->init;
Hooks are named callbacks points in your application. Hooks can be used to add plugin functionality.
HashRef of Gapp::App::Hook objects.
Will call callbacks for $hook_name, passing in the supplied params. Callbacks are associated with hooks using the hook method.
$hook_name
params
hook
Bind a callback to the given $hook_name.
Register a hook with the application. See <Gapp::App::Hook> for available options.
Jeffrey Ray Hallock <jeffrey.hallock at gmail dot com>
Copyright (c) 2010-2012 Jeffrey Ray Hallock.
This is free software, licensed under: The Artistic License 2.0 (GPL Compatible)
To install Gapp::App, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gapp::App
CPAN shell
perl -MCPAN -e shell install Gapp::App
For more information on module installation, please visit the detailed CPAN module installation guide.