[Catalyst] PathPart("") v PathPart compared with Path("") v Path

Tomas Doran bobtfish at bobtfish.net
Sat Feb 28 22:32:29 GMT 2009


On 28 Feb 2009, at 21:27, Ashley wrote:
> Just throwing that out there if anyone is under that part of the  
> hood or someone Googling for why their Chained stuff won't work  
> made the same error in assumptions I just did. :)

Wild stab in the dark, Path works like this:

     my @register = @{ $action->attributes->{Path} || [] };
     $self->register_path( $c, $_, $action ) for @register;

Chained works like this:

     my @path_part = @{ $action->attributes->{PathPart} || [] };
     if (@path_part == 1 && defined $path_part[0]) {
         $part = $path_part[0];

I'd guess in the case where you say PathPart (rather than PathPath 
(''), then $action->attributes->{PathPart} returns [ undef ], which  
is explicitly excluded by the code above. I bet (although I haven't  
checked) that register_path does the right thing if !defined($_)..)

Have a dive in the test suite and see if you can cook up a test which  
shows the inconsistency with PathPart?

We should either allow "PathPart" to work like "Path", or, if there  
is good reason why it needs to be "PathPart('')" (which I can't think  
of, given we have : Local), then "Path" should be deprecated to  
maintain consistency.

Cheers
t0m






More information about the Catalyst mailing list