[Catalyst] Return multiple values from a forward?

Brian Cassidy brian.cassidy at nald.ca
Tue Jan 16 18:32:55 GMT 2007


Ryan Detzel wrote:
> Can it be done, I keep getting weird results.  I want to do
>
>
> my ($val1,$val2) = $c->forward('test');
>
>
> sub test : Private {
The return value of a forward isn't really something you should rely on, 
but, if you must, you can return an array reference:

my ($val1,$val2) = @{ $c->forward('test') };

sub test : Private {
    return ['val1', 'val2'];
}

Ideally, you should be calling it just as a regular method:

my ($val1,$val2) = $self->test;

sub test {
    return 'val1', 'val2';
}

-Brian



More information about the Catalyst mailing list