[Catalyst-commits] r6291 - in trunk/Catalyst-Controller-PathArgs:
lib/Catalyst/Controller t/lib/TestApp/Controller
zby at dev.catalyst.perl.org
zby at dev.catalyst.perl.org
Tue Apr 17 18:45:29 GMT 2007
Author: zby
Date: 2007-04-17 18:45:29 +0100 (Tue, 17 Apr 2007)
New Revision: 6291
Modified:
trunk/Catalyst-Controller-PathArgs/lib/Catalyst/Controller/PathArgs.pm
trunk/Catalyst-Controller-PathArgs/t/lib/TestApp/Controller/Pathargsroot.pm
Log:
Overriding create_action instead of the parsing methods.
Modified: trunk/Catalyst-Controller-PathArgs/lib/Catalyst/Controller/PathArgs.pm
===================================================================
--- trunk/Catalyst-Controller-PathArgs/lib/Catalyst/Controller/PathArgs.pm 2007-04-17 16:44:52 UTC (rev 6290)
+++ trunk/Catalyst-Controller-PathArgs/lib/Catalyst/Controller/PathArgs.pm 2007-04-17 17:45:29 UTC (rev 6291)
@@ -1,6 +1,7 @@
package Catalyst::Controller::PathArgs;
use strict;
use base 'Catalyst::Controller';
+use NEXT;
our $VERSION = '0.1';
@@ -22,18 +23,22 @@
#################### subroutine header end ####################
-sub _parse_PathArgs_attr {
- my ( $self, $c, $name, $value ) = @_;
- warn "_parse_PathArgs_attr $value\n";
- return ( 'Chained', '.', 'CaptureArgs', $value );
+sub create_action {
+ my $self = shift;
+ my %args = @_;
+ my $attributes = $args{attributes};
+ if ( my $args_num = $attributes->{PathArgs} ){
+ $attributes->{Chained} = [ '.' ];
+ if ( $attributes->{EndPoint} ){
+ $attributes->{Args} = [ $args_num->[0] ];
+ }else{
+ $attributes->{CaptureArgs} = [ $args_num->[0] ];
+ }
+ }
+ return $self->NEXT::create_action( %args );
}
-sub _parse_PathArgsEnd_attr {
- my ( $self, $c, $name, $value ) = @_;
- return ( 'Chained', '.', 'Args', $value );
-}
-
#################### main pod documentation begin ###################
## Below is the stub of documentation for your module.
## You better edit it!
Modified: trunk/Catalyst-Controller-PathArgs/t/lib/TestApp/Controller/Pathargsroot.pm
===================================================================
--- trunk/Catalyst-Controller-PathArgs/t/lib/TestApp/Controller/Pathargsroot.pm 2007-04-17 16:44:52 UTC (rev 6290)
+++ trunk/Catalyst-Controller-PathArgs/t/lib/TestApp/Controller/Pathargsroot.pm 2007-04-17 17:45:29 UTC (rev 6291)
@@ -3,7 +3,7 @@
use base 'Catalyst::Controller::PathArgs';
-sub pathargsend : PathArgsEnd(1) { }
+sub pathargsend : PathArgs(1) EndPoint { }
sub aaa : Local {}
More information about the Catalyst-commits
mailing list