X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=8d84e858d5c3d9211b7d405c6fec89ab041130ae;hb=1d4ea19dc484e729cef526db0f72927a9ba5d62b;hp=98a1f922b82802fef710505c85720215e2518990;hpb=6372237c9bd3714b1c8940503ec89878fc27a3e1;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 98a1f92..8d84e85 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -250,7 +250,7 @@ sub finalize_output { } Forward processing to a private action or a method from a class. If you define a class without method it will default to process(). - $c->forward('foo'); + $c->forward('/foo'); $c->forward('index'); $c->forward(qw/MyApp::Model::CDBI::Foo do_stuff/); $c->forward('MyApp::View::TT'); @@ -266,7 +266,7 @@ sub forward { } my $caller = caller(0); my $namespace = '/'; - if ( $command =~ /^\/$/ ) { + if ( $command =~ /^\// ) { $command =~ /^(.*)\/(\w+)$/; $namespace = $1 || '/'; $command = $2; @@ -444,8 +444,8 @@ sub prepare { } $c->prepare_request($r); $c->prepare_path; - $c->prepare_cookies; $c->prepare_headers; + $c->prepare_cookies; $c->prepare_connection; my $method = $c->req->method || ''; my $path = $c->req->path || ''; @@ -638,11 +638,11 @@ sub set_action { my %flags; for my $attr ( @{$attrs} ) { - if ( $attr =~ /^Local$/ ) { $flags{local}++ } - elsif ( $attr =~ /^Global$/ ) { $flags{global}++ } - elsif ( $attr =~ /^Path\((.+)\)$/i ) { $flags{path} = $1 } - elsif ( $attr =~ /^Private$/i ) { $flags{private}++ } - elsif ( $attr =~ /Regex\((.+)\)$/i ) { $flags{regex} = $1 } + if ( $attr =~ /^(Local|Relative)$/ ) { $flags{local}++ } + elsif ( $attr =~ /^(Global|Absolute)$/ ) { $flags{global}++ } + elsif ( $attr =~ /^Path\((.+)\)$/i ) { $flags{path} = $1 } + elsif ( $attr =~ /^Private$/i ) { $flags{private}++ } + elsif ( $attr =~ /^(Regex|Regexp)\((.+)\)$/i ) { $flags{regex} = $2 } } return unless keys %flags; @@ -689,6 +689,7 @@ sub set_action { $path = $1; $absolute = 1; } + $absolute = 1 if $flags{global}; my $name = $absolute ? $path : "$prefix/$path"; $c->actions->{plain}->{$name} = [ $namespace, $code ]; $c->log->debug(qq|Public "/$name" is "/$forward"|) if $c->debug; @@ -808,9 +809,11 @@ sub _prefix { sub _class2prefix { my $class = shift || ''; - $class =~ /^.*::([MVC]|Model|View|Controller)?::(.*)$/; - my $prefix = lc $2 || ''; - $prefix =~ s/\:\:/\//g; + my $prefix; + if ($class =~ /^.*::([MVC]|Model|View|Controller)?::(.*)$/) { + $prefix = lc $2; + $prefix =~ s/\:\:/\//g; + } return $prefix; }