X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=61d9bfc1db2147924083f2764b91682c5cbf7a5c;hb=7069eab51d9488288772eafa8b4854617645b2a1;hp=b60196207d6739bb3382abed49ff634195d362f8;hpb=829b22f766b0b1d1a09a6ce152abe48ad9bde5ec;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index b601962..61d9bfc 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -1206,6 +1206,12 @@ path, use C<< $c->uri_for_action >> instead. sub uri_for { my ( $c, $path, @args ) = @_; + if (blessed($path) && $path->isa('Catalyst::Controller')) { + $path = $path->path_prefix; + $path =~ s{/+\z}{}; + $path .= '/'; + } + if ( blessed($path) ) { # action object my $captures = ( scalar @args && ref $args[0] eq 'ARRAY' ? shift(@args) @@ -2215,10 +2221,11 @@ sub setup_component { my $suffix = Catalyst::Utils::class2classsuffix( $component ); my $config = $class->config->{ $suffix } || {}; - $config->{_component_name} = $component; # Put this in args here, rather - # than in COMPONENT as there - # are lots of custom COMPONENT - # methods.. + # Stash _component_name in the config here, so that custom COMPONENT + # methods also pass it. local to avoid pointlessly shitting in config + # for the debug screen, as $component is already the key name. + local $config->{_component_name} = $component; + my $instance = eval { $component->COMPONENT( $class, $config ); }; if ( my $error = $@ ) {