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 };
}
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;
&& $c->action->can('execute')
&& $c->req->action )
{
- $c->action->execute($c);
+ $c->action->dispatch( $c );
}
return !@{ $c->error };
}
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 };
}
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) ) {
+ $class->require;
+ die "Couldn't load action class ${class}: $@" if $@;
+ }
+
+ return $class->new( \%args );
}
sub _parse_attrs {
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<Catalyst>, L<Catalyst::Controller>.