| 1 | |||
| 2 | package ASP4::HandlerRunner; | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings 'all'; | ||
| 6 | |||
| 7 | |||
| 8 | sub new | ||
| 9 | { | ||
| 10 | my ($class, %args) = @_; | ||
| 11 | |||
| 12 | return bless \%args, $class; | ||
| 13 | }# end new() | ||
| 14 | |||
| 15 | |||
| 16 | sub context { ASP4::HTTPContext->current } | ||
| 17 | |||
| 18 | |||
| 19 | sub run_handler | ||
| 20 | { | ||
| 21 | my ($s, $handler_class, $args) = @_; | ||
| 22 | |||
| 23 | my $handler = $handler_class->new(); | ||
| 24 | $handler_class->init_asp_objects( $s->context ); | ||
| 25 | $handler_class->before_run( $s->context, $args ); | ||
| 26 | if( ! $s->{did_end} ) | ||
| 27 | { | ||
| 28 | $handler_class->run( $s->context, $args ); | ||
| 29 | $handler_class->after_run( $s->context, $args ); | ||
| 30 | }# end if() | ||
| 31 | }# end run_handler() | ||
| 32 | |||
| 33 | 1;# return true: | ||
| 34 |