Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 24a96170

Von Moritz Bunkus vor mehr als 12 Jahren hinzugefügt

  • ID 24a9617088c80727bd4b348c8592224e447b9b92
  • Vorgänger cf6c2739
  • Nachfolger cf32b30b

Controller-Basisklasse: bei run_before/after-Hooks den Namen der Action mitgeben

Unterschiede anzeigen:

SL/Controller/Base.pm
160 160
         || ($hook->{except} &&  $hook->{except}->{$action});
161 161

  
162 162
    if (ref($hook->{code}) eq 'CODE') {
163
      $hook->{code}->($self);
163
      $hook->{code}->($self, $action);
164 164
    } else {
165 165
      my $sub = $hook->{code};
166
      $self->$sub;
166
      $self->$sub($action);
167 167
    }
168 168
  }
169 169
}
......
328 328

  
329 329
Hooks are run in the order they're added.
330 330

  
331
The hooks receive a single parameter: the name of the action that is
332
about to be called (for C<before> hooks) / was called (for C<after>
333
hooks).
334

  
331 335
The return value of the hooks is discarded.
332 336

  
333 337
Hooks can be defined to run for all actions, for only specific actions

Auch abrufbar als: Unified diff