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=83b4da3937bd7b700372d5d3c849bca2fb2eaccd;hp=a74eb29f0ef1fa8cf986a784c3cca079a12757a8;hb=38007d99db1774891d373242c86382e6f5cb083a;hpb=f3414019f472b55682ef3af53f761b6db7955887 diff --git a/lib/Catalyst/Action.pm b/lib/Catalyst/Action.pm index a74eb29..83b4da3 100644 --- a/lib/Catalyst/Action.pm +++ b/lib/Catalyst/Action.pm @@ -17,7 +17,6 @@ L subclasses. =cut -use Class::C3; use Moose; has class => (is => 'rw'); @@ -29,23 +28,28 @@ has code => (is => 'rw'); no Moose; +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, + +); + + + no warnings 'recursion'; #__PACKAGE__->mk_accessors(qw/class namespace reverse attributes name code/); 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 ); - - #believed to be equivalent: - my $orig = $c->namespace; - $c->namespace($self->namespace); - my $ret = $c->execute( $self->class, $self ); - $c->namespace($orig); - return $ret; + return $c->execute( $self->class, $self ); } sub execute { @@ -115,9 +119,9 @@ returns the sub name of this action. Provided by Moose -=head1 AUTHOR +=head1 AUTHORS -Matt S. Trout +Catalyst Contributors, see Catalyst.pm =head1 COPYRIGHT