X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=59b30c29a6a0f9893471da78a00b3d0683be662f;hb=9d17368e8d5a29c37d3a98332da6a00976643a49;hp=46f6baec0f5cb14035557f398dab5a5e960b517c;hpb=81557adfb9a2cc7059fceb7782105ca5121d7de5;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 46f6bae..59b30c2 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -1,7 +1,7 @@ package Catalyst; use strict; -use base 'Catalyst::Base'; +use base 'Catalyst::Component'; use bytes; use UNIVERSAL::require; use Catalyst::Exception; @@ -10,6 +10,7 @@ use Catalyst::Request; use Catalyst::Request::Upload; use Catalyst::Response; use Catalyst::Utils; +use Catalyst::Controller; use File::stat; use NEXT; use Text::SimpleTable; @@ -71,7 +72,7 @@ sub import { unless ( $caller->isa('Catalyst') ) { no strict 'refs'; - push @{"$caller\::ISA"}, $class; + push @{"$caller\::ISA"}, $class, 'Catalyst::Controller'; } $caller->arguments( [@arguments] ); @@ -933,15 +934,20 @@ sub execute { } # determine if the call was the result of a forward - my $callsub_index = ( caller(0) )[0]->isa('Catalyst::Action') ? 2 : 1; - if ( ( caller($callsub_index) )[3] =~ /^NEXT/ ) { - - # work around NEXT if execute was extended by a plugin - $callsub_index += 3; + # this is done by walking up the call stack and looking for a calling + # sub of Catalyst::forward before the eval + my $callsub = q{}; + for my $index (1..10) { + last + if ( ( caller($index) )[0] eq 'Catalyst' + && ( caller($index) )[3] eq '(eval)' ); + + if ( (caller($index))[3] =~ /forward$/ ) { + $callsub = (caller($index))[3]; + $action = "-> $action"; + last; + } } - my $callsub = ( caller($callsub_index) )[3]; - - $action = "-> $action" if $callsub =~ /forward$/; my $node = Tree::Simple->new( { @@ -1544,7 +1550,7 @@ sub setup_components { my $callback = sub { my ( $component, $context ) = @_; - unless ( $component->isa('Catalyst::Component') ) { + unless ( $component->can('COMPONENT') ) { return $component; }