=head2 $self->match( $c, $path )
-Check for paths that match the given path.
+For each action registered to this exact path, offers the action a chance to
+match the path (in the order in which they were registered). Succeeds on the
+first action that matches, if any; if not, returns 0.
=cut
=head2 $self->register( $c, $action )
-Call register_path for every path attribute in the given $action.
+Calls register_path for every Path attribute for the given $action.
=cut
=head2 $self->register_path($c, $path, $action)
-register an action at a given path.
+Registers an action at a given path.
=cut
return 1;
}
+=head2 $self->uri_for_action($action, $captures)
+
+get a URI part for an action; always returns undef is $captures is set
+since Path actions don't have captures
+
+=cut
+
+sub uri_for_action {
+ my ( $self, $action, $captures ) = @_;
+
+ return undef if @$captures;
+
+ if (my $paths = $action->attributes->{Path}) {
+ my $path = $paths->[0];
+ $path = '/' unless length($path);
+ $path = "/${path}" unless ($path =~ m/^\//);
+ $path = URI->new($path)->canonical;
+ return $path;
+ } else {
+ return undef;
+ }
+}
+
=head1 AUTHOR
Matt S Trout