}
# Execute the auto chain
- my $auto = 0;
- for my $auto ( @{ $c->get_action( 'auto', $namespace ) } ) {
+ my $auto;
+ for $auto ( @{ $c->get_action( 'auto', $namespace ) } ) {
$c->execute( @{ $auto->[0] } );
return if scalar @{ $c->error };
last unless $c->state;
- $auto++;
}
# Execute the action or last default
- my $mkay = $auto ? $c->state ? 1 : 0 : 1;
+ my $mkay = defined $auto ? $c->state ? 1 : 0 : 1;
if ( ( my $action = $c->req->action ) && $mkay ) {
if ( my $result = @{ $c->get_action( $action, $default ) }[-1] ) {
$c->execute( @{ $result->[0] } );
unless ( @{$results} ) {
my $class = $command || '';
+ my $path = $class . '.pm';
+ $path =~ s/::/\//g;
- if ( $class =~ /[^\w\:]/ ) {
- my $error = qq/"$class" is an invalid Class name/;
+ unless ( $INC{$path} ) {
+ my $error =
+ qq/Couldn't forward to "$class". Invalid or not loaded./;
+ $c->error($error);
+ $c->log->debug($error) if $c->debug;
+ return 0;
+ }
+
+ unless ( UNIVERSAL::isa( $class, 'Catalyst::Base' ) ) {
+ my $error =
+ qq/Can't forward to "$class". Class is not a Catalyst component./;
$c->error($error);
$c->log->debug($error) if $c->debug;
return 0;
}
else {
- my $error = qq/Couldn't forward to "$class". Does not implement "$method"/;
+ my $error =
+ qq/Couldn't forward to "$class". Does not implement "$method"/;
$c->error($error);
$c->log->debug($error)
if $c->debug;
for my $comp (@$comps) {
$comp = ref $comp || $comp;
- for my $action ( @{ $comp->_cache } ) {
+ for my $action ( @{ Catalyst::Utils::reflect_actions($comp) } ) {
my ( $code, $attrs ) = @{$action};
my $name = '';
no strict 'refs';