X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FBase.pm;h=c4a6dc7dca2e004f995543d1e7e3365c4a0cd5bf;hb=e80e8542290e1c62b3c6dbee4265691d7ad634c3;hp=b1990e9b692eaa599db906f5085fb2563d7028e3;hpb=f40acefd4fe550234f968f2724cbfe028fca31cd;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Base.pm b/lib/Catalyst/Base.pm index b1990e9..c4a6dc7 100644 --- a/lib/Catalyst/Base.pm +++ b/lib/Catalyst/Base.pm @@ -27,7 +27,7 @@ sub _BEGIN : Private { my ( $self, $c ) = @_; my $begin = ( $c->get_actions( 'begin', $c->namespace ) )[-1]; return 1 unless $begin; - $begin->execute($c); + $begin->dispatch( $c ); return !@{ $c->error }; } @@ -35,7 +35,7 @@ sub _AUTO : Private { my ( $self, $c ) = @_; my @auto = $c->get_actions( 'auto', $c->namespace ); foreach my $auto (@auto) { - $auto->execute($c); + $auto->dispatch( $c ); return 0 unless $c->state; } return 1; @@ -47,7 +47,7 @@ sub _ACTION : Private { && $c->action->can('execute') && $c->req->action ) { - $c->action->execute($c); + $c->action->dispatch( $c ); } return !@{ $c->error }; } @@ -56,7 +56,7 @@ sub _END : Private { my ( $self, $c ) = @_; my $end = ( $c->get_actions( 'end', $c->namespace ) )[-1]; return 1 unless $end; - $end->execute($c); + $end->dispatch( $c ); return !@{ $c->error }; } @@ -151,7 +151,17 @@ sub register_actions { sub create_action { my $self = shift; - $self->_action_class->new( { @_ } ); + my %args = @_; + + my $class = (exists $args{attributes}{ActionClass} + ? $args{attributes}{ActionClass}[0] + : $self->_action_class); + + unless ( Class::Inspector->loaded($class) ) { + require Class::Inspector->filename($class); + } + + return $class->new( \%args ); } sub _parse_attrs { @@ -220,6 +230,14 @@ sub _parse_LocalRegex_attr { sub _parse_LocalRegexp_attr { shift->_parse_LocalRegex_attr(@_); } +sub _parse_ActionClass_attr { + my ( $self, $c, $name, $value ) = @_; + unless ( $value =~ s/^\+// ) { + $value = join('::', $self->_action_class, $value ); + } + return ( 'ActionClass', $value ); +} + =head1 SEE ALSO L, L.