X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/540c0b5e9a38158e6f7a6efacd20b2477efad7ac..c6e1a58a83d86cf310295d5b12821d11ec2d6eb0:/SL/Controller/Base.pm diff --git a/SL/Controller/Base.pm b/SL/Controller/Base.pm index f99b1e722..4dace86ed 100644 --- a/SL/Controller/Base.pm +++ b/SL/Controller/Base.pm @@ -160,10 +160,10 @@ sub _run_hooks { || ($hook->{except} && $hook->{except}->{$action}); if (ref($hook->{code}) eq 'CODE') { - $hook->{code}->($self); + $hook->{code}->($self, $action); } else { my $sub = $hook->{code}; - $self->$sub; + $self->$sub($action); } } } @@ -204,7 +204,7 @@ sub _run_action { } sub _controller_name { - return (split(/::/, ref($_[0])))[-1]; + return (split(/::/, ref($_[0]) || $_[0]))[-1]; } sub _dispatch { @@ -328,6 +328,10 @@ hooks themselves are run as instance methods. Hooks are run in the order they're added. +The hooks receive a single parameter: the name of the action that is +about to be called (for C hooks) / was called (for C +hooks). + The return value of the hooks is discarded. Hooks can be defined to run for all actions, for only specific actions