sub _add_route {
my $rest = shift;
my $meta = shift;
- my ( $name, $attrs, $sub ) = _process_args(@_);
+ my ( $name, $attrs, $sub ) = _process_args( $meta, @_ );
my $meth_base = '__route__' . $name;
return;
}
-sub path_part ($) {
- return ( PathPart => [ $_[0] ] );
-}
-
sub chained ($) {
return ( Chained => [ $_[0] ] );
}
return ( CaptureArgs => [ $_[0] ] );
}
+sub path_part ($) {
+ return ( PathPart => [ $_[0] ] );
+}
+
sub action ($) {
return ( ActionClass => [ $_[0] ] );
}
sub _process_args {
+ my $meta = shift;
my $path = shift;
my $sub = pop;
my %p = @_;
- $p{ActionClass} ||= 'REST';
+ $p{ActionClass} ||= 'REST::ForBrowsers';
+
+ unless ( exists $p{Chained} ) {
+ $p{Chained} = q{/};
+
+ unless ( $p{PathPart} ) {
+ my $part = $path;
+ unless ( $part =~ s{^/}{} ) {
+ $part = $meta->name()->action_namespace('FakeConfig') . q{/} . $part;
+ }
+
+ $p{PathPart} = [$part];
+ }
+ }
+
+ unless ( $p{Args} || $p{Local} ) {
+ $p{Args} = [0];
+ }
( my $name = $path ) =~ s/(\W)/'X' . sprintf( '%x', ord($1) )/eg;
&& length "$_[0]" );
}
+{
+ # This is a nasty hack around some weird back compat code in
+ # Catalyst::Controller->action_namespace
+ package FakeConfig;
+
+ sub config {
+ return { case_sensitive => 0 };
+ }
+}
+
1;