Revision af56ae02
Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt
SL/DB/Object/Hooks.pm | ||
---|---|---|
44 | 44 |
|
45 | 45 |
foreach my $sub (@{ ( $hooks{$when} || { })->{ ref($object) } || [ ] }) { |
46 | 46 |
my $result = ref($sub) eq 'CODE' ? $sub->($object, @args) : $object->call_sub($sub, @args); |
47 |
die SL::X::DBHookError->new( |
|
48 |
hook => (ref($sub) eq 'CODE' ? '<anonymous sub>' : $sub), |
|
49 |
when => $when, |
|
50 |
object => $object, |
|
51 |
) if !$result; |
|
47 |
die SL::X::DBHookError->new(when => $when, |
|
48 |
hook => (ref($sub) eq 'CODE' ? '<anonymous sub>' : $sub), |
|
49 |
object => $object) |
|
50 |
if !$result; |
|
52 | 51 |
} |
53 | 52 |
} |
54 | 53 |
|
... | ... | |
122 | 121 |
An exception of C<SL::X::DBHookError> is thrown if any of the hooks |
123 | 122 |
returns a falsish value. |
124 | 123 |
|
125 |
This function is supposed to be called by L<Rose::DB::Object/load>,
|
|
126 |
L<Rose::DB::Object/save> or L<Rose::DB::Object/delete>.
|
|
124 |
This function is supposed to be called by L</SL::DB::Object::load>,
|
|
125 |
L</SL::DB::Object::save> or L</SL::DB::Object::delete>.
|
|
127 | 126 |
|
128 | 127 |
=back |
129 | 128 |
|
Auch abrufbar als: Unified diff
Framework für after/before-Hooks bei load/save/delete
Conflicts:
Verwendung von Exception::Lite anstelle von ExceptionClass wie im
Kundenprojekt.