X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FPath.pm;h=7f32b61542b39c738285ee00d1695e772ca41385;hb=1b1636b58ce5f1feabd0d125c3928c57e5a5cf3c;hp=9cd1a150a78f76ef0a18e402583c1bb4ff4e4910;hpb=5b707014dd4a5a756d22bcafc6c99e2b00a52d06;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/DispatchType/Path.pm b/lib/Catalyst/DispatchType/Path.pm index 9cd1a15..7f32b61 100644 --- a/lib/Catalyst/DispatchType/Path.pm +++ b/lib/Catalyst/DispatchType/Path.pm @@ -19,11 +19,13 @@ See L. =head2 $self->list($c) +Debug output for Path dispatch points + =cut sub list { my ( $self, $c ) = @_; - my $paths = Text::SimpleTable->new( [ 36, 'Path' ], [ 37, 'Private' ] ); + my $paths = Text::SimpleTable->new( [ 35, 'Path' ], [ 36, 'Private' ] ); for my $path ( sort keys %{ $self->{paths} } ) { my $action = $self->{paths}->{$path}; $path = "/$path" unless $path eq '/'; @@ -35,6 +37,8 @@ sub list { =head2 $self->match( $c, $path ) +Check for paths that match the given path. + =cut sub match { @@ -55,12 +59,14 @@ sub match { =head2 $self->register( $c, $action ) +Call register_path for every path attribute in the given $action. + =cut sub register { my ( $self, $c, $action ) = @_; - my @register = @{$action->attributes->{Path}||[]}; + my @register = @{ $action->attributes->{Path} || [] }; $self->register_path( $c, $_, $action ) for @register; @@ -70,6 +76,8 @@ sub register { =head2 $self->register_path($c, $path, $action) +register an action at a given path. + =cut sub register_path { @@ -77,6 +85,7 @@ sub register_path { $path =~ s!^/!!; $path = '/' unless length $path; $path = URI->new($path)->canonical; + $self->{paths}{$path} = $action; }