[Catalyst] forward returns 0 to caller when called action returns undef

Norbert CSONGRADI - services.hu network bert at services.hu
Wed Apr 12 11:38:45 CEST 2006


Hi,

I have a problem with forward return value when the called action wants to 
return undef value.

Test code follows:

package Test::Controller::Test;

use strict;
use warnings;
use base 'Catalyst::Controller';

sub Test : Local {
    my( $self, $c ) = @_;

    $c->log->debug( "Returned value: ".$c->forward( '/Test2/test2' ) );
}

package Test::Controller::Test2;

use strict;
use warnings;
use base 'Catalyst::Controller';

sub test2 : Private {
    my( $self, $c ) = @_;

    $c->log->debug( "test2 called" );

    return;
}

1;

################
#
# Output:
# [Wed Apr 12 10:52:11 2006] [catalyst] [debug] Path is "Test/Test"
# [Wed Apr 12 10:52:11 2006] [catalyst] [debug] test2 called
# [Wed Apr 12 10:52:11 2006] [catalyst] [debug] Returned value: 0

Found out (with some help :) that execute in Catalyst.pm sets the $c->state to 
0 when undef is returned, so the attached patch removes this "feature" and 
now I have real undefs :).

-- 
	Regards,
		Bert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: forward_return_undef.patch
Type: text/x-diff
Size: 655 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060412/ae7319d8/attachment.bin 


More information about the Catalyst mailing list