X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FAction.pm;h=b42653075f0dd4e50e059375a43d36b18568cd29;hp=0e2bb583f46c45e5eb40c57905ec3de584e22875;hb=6f1f968a6bc42bf4a4b50a1ee22d3aaecd801876;hpb=ac5c933bdd463558e8d621507a53a7b247a9093e diff --git a/lib/Catalyst/Action.pm b/lib/Catalyst/Action.pm index 0e2bb58..b426530 100644 --- a/lib/Catalyst/Action.pm +++ b/lib/Catalyst/Action.pm @@ -17,14 +17,16 @@ L subclasses. =cut +use MRO::Compat; +use mro 'c3'; use Moose; -has class => (is => 'rw'); -has namespace => (is => 'rw'); -has 'reverse' => (is => 'rw'); -has attributes => (is => 'rw'); -has name => (is => 'rw'); -has code => (is => 'rw'); +has class => (is => 'rw'); +has namespace => (is => 'rw'); +has 'reverse' => (is => 'rw'); +has attributes => (is => 'rw'); +has name => (is => 'rw'); +has code => (is => 'rw'); no Moose; @@ -32,32 +34,19 @@ no warnings 'recursion'; #__PACKAGE__->mk_accessors(qw/class namespace reverse attributes name code/); -use overload ( - - # Stringify to reverse for debug output etc. - q{""} => sub { shift->reverse() }, - - # Codulate to execute to invoke the encapsulated action coderef - '&{}' => sub { my $self = shift; sub { $self->execute(@_); }; }, - - # Make general $stuff still work - fallback => 1, - -); - sub dispatch { # Execute ourselves against a context my ( $self, $c ) = @_; #Moose todo: grrrrrr. this is no good. i don't know enough about it to # debug it though. why can't we just call the accessor? - local $c->{namespace} = $self->namespace; - return $c->execute( $self->class, $self ); + #local $c->{namespace} = $self->namespace; + #return $c->execute( $self->class, $self ); #believed to be equivalent: - #my $orig = $c->namespace; - #$c->namespace($self->namespace); - #my $ret = $c->execute( $self->class, $self ); - #$c->namespace($orig); - #return $ret; + my $orig = $c->namespace; + $c->namespace($self->namespace); + my $ret = $c->execute( $self->class, $self ); + $c->namespace($orig); + return $ret; } sub execute {