From: Moritz Bunkus Date: Tue, 3 May 2011 15:45:53 +0000 (+0200) Subject: Framework für after/before-Hooks bei load/save/delete X-Git-Tag: release-2.7.0beta1~396^2~2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=af56ae02cd83ad4fff35a3ef695a9fcf4c074caf;p=kivitendo-erp.git Framework für after/before-Hooks bei load/save/delete Conflicts: SL/X.pm Verwendung von Exception::Lite anstelle von ExceptionClass wie im Kundenprojekt. --- diff --git a/SL/DB/Object/Hooks.pm b/SL/DB/Object/Hooks.pm index e47951407..ac3b0a2e6 100644 --- a/SL/DB/Object/Hooks.pm +++ b/SL/DB/Object/Hooks.pm @@ -44,11 +44,10 @@ sub run_hooks { foreach my $sub (@{ ( $hooks{$when} || { })->{ ref($object) } || [ ] }) { my $result = ref($sub) eq 'CODE' ? $sub->($object, @args) : $object->call_sub($sub, @args); - die SL::X::DBHookError->new( - hook => (ref($sub) eq 'CODE' ? '' : $sub), - when => $when, - object => $object, - ) if !$result; + die SL::X::DBHookError->new(when => $when, + hook => (ref($sub) eq 'CODE' ? '' : $sub), + object => $object) + if !$result; } } @@ -122,8 +121,8 @@ C function names above. An exception of C is thrown if any of the hooks returns a falsish value. -This function is supposed to be called by L, -L or L. +This function is supposed to be called by L, +L or L. =back