Subject: | Action forwarding in REST controllers produce a warning in Catalyst.pm |
Hi!
When using
$c->forward('action'); # One-argument version
..inside a REST Controller class, I get this warning when browsing to
the root page:
Use of uninitialized value in concatenation (.) or string at
/usr/lib/perl5/site_perl/5.8.8/Catalyst.pm line 1270.
To get get this warning, I created a plain Catalyst "MyApp" the usual
way, and replaced Root.pm with the following:
--------------------->8==============================
#!/usr/bin/perl
# lib/MyApp/Controller/Root.pm
package MyApp::Controller::Root;
use strict;
use warnings;
use base 'Catalyst::Controller::REST';
__PACKAGE__->config->{namespace} = '';
sub default : Path :ActionClass('REST') {}
sub default_GET {
my ( $self, $c ) = @_;
$c->forward('forward_target');
}
sub forward_target : Local {
my ( $self, $c ) = @_;
$c->response->body( $c->welcome_message );
}
sub end : ActionClass('RenderView') {}
1;
__END__
--------------------------->8=====================
.... And to force the warning w/Carp, I added this to
script/myapp_server.pl:
================================8<--------
use Carp qw(confess cluck);
$SIG{__DIE__} = \&Carp::confess;
$SIG{__WARN__} = \&Carp::cluck;
====================8<--------------------
I won't paste the output of that here, but you can add the lines
yourself to find out what's going on.
I'm using Catalyst::Runtime 5.7011 and Catalyst::Action::REST 0.50.
Hope this helps! :)
- Salve