
ecrockford at invicro
Jan 18, 2013, 7:35 AM
Post #1 of 1
(235 views)
Permalink
|
|
Problem with Catalyst::Controller handling CreateToken attributes
|
|
Have recently been porting an existing Catalyst site to run under Centos 6 (using the current CPAN version of Catalyst). The site would not start and gave the following error message: Can't locate Catalyst/Action/Catalyst/Controller/RequestToken/Action/CreateToken.pm in @INC (@INC contains: /opt/src/ipacs/script/../lib /opt/invicro/lib/perl5/5.10.1/x86_64-linux /opt/invicro/lib/perl5/5.10.1 /opt/invicro/lib/perl5/site_perl/5.10.1/x86_64-linux /opt/invicro/lib/perl5/site_perl/5.10.1 .) at /opt/invicro/lib/perl5/site_perl/5.10.1/Catalyst.pm line 2485. It should be trying to include Catalyst/Controller/RequestToken/Action/CreateToken.pm but Catalyst/Action/ has been tacked on the front of the path. The method calls generating the problem looked something like this: sub index : Path : CreateToken { After lengthy investigation I discovered that the problem was in the Catalyst::Controller module around line 422. while (my ($new_key, $value) = each %new_attrs){ my $new_attrs = $key eq $new_key ? { $new_key => [$value] } : $self->_parse_attr($c, $name, $new_key => $value ); push @{ $final_attributes{$_} }, @{ $new_attrs->{$_} } for keys %$new_attrs; } $new_key (as return by the _parse_CreateToken_attr method of Catalyst/Controller/RequestToken.pm) is ActionClass while $key is CreateToken so $self->_parse_attr is called again which adds the unwanted Catalyst/Action to the front of the class name. This generates the error above. I fixed the problem temporarily by merely skipping the equality test when the attribute contained 'Token'. This made the site work again but this is truely inelegant. Is this a known problem with a fix or can anyone guide me to a better way of fixing it? Thanks Edwin _______________________________________________ Catalyst-dev mailing list Catalyst-dev [at] lists http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
|