[Catalyst-commits] r7502 -
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType
groditi at dev.catalyst.perl.org
groditi at dev.catalyst.perl.org
Sat Mar 15 04:51:02 GMT 2008
Author: groditi
Date: 2008-03-15 04:51:02 +0000 (Sat, 15 Mar 2008)
New Revision: 7502
Modified:
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Path.pm
Log:
Path done
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Path.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Path.pm 2008-03-15 04:42:23 UTC (rev 7501)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Path.pm 2008-03-15 04:51:02 UTC (rev 7502)
@@ -8,6 +8,13 @@
use Text::SimpleTable;
use URI;
+has _paths => (
+ is => 'rw',
+ isa => 'HashRef',
+ required => 1,
+ default => sub { +{} },
+ );
+
=head1 NAME
Catalyst::DispatchType::Path - Path DispatchType
@@ -29,14 +36,14 @@
sub list {
my ( $self, $c ) = @_;
my $paths = Text::SimpleTable->new( [ 35, 'Path' ], [ 36, 'Private' ] );
- foreach my $path ( sort keys %{ $self->{paths} } ) {
+ foreach my $path ( sort keys %{ $self->_paths } ) {
my $display_path = $path eq '/' ? $path : "/$path";
- foreach my $action ( @{ $self->{paths}->{$path} } ) {
+ foreach my $action ( @{ $self->_paths->{$path} } ) {
$paths->row( $display_path, "/$action" );
}
}
$c->log->debug( "Loaded Path actions:\n" . $paths->draw . "\n" )
- if ( keys %{ $self->{paths} } );
+ if ( keys %{ $self->_paths } );
}
=head2 $self->match( $c, $path )
@@ -52,7 +59,7 @@
$path ||= '/';
- foreach my $action ( @{ $self->{paths}->{$path} || [] } ) {
+ foreach my $action ( @{ $self->_paths->{$path} || [] } ) {
next unless $action->match($c);
$c->req->action($path);
$c->req->match($path);
@@ -93,7 +100,7 @@
$path = '/' unless length $path;
$path = URI->new($path)->canonical;
- unshift( @{ $self->{paths}{$path} ||= [] }, $action);
+ unshift( @{ $self->_paths->{$path} ||= [] }, $action);
return 1;
}
More information about the Catalyst-commits
mailing list