[Catalyst] difficulty in assigning an array to a stash

Lars Balker Rasmussen lars at balker.dk
Sun Nov 11 16:41:54 GMT 2007


On Sun, Nov 11, 2007 at 09:58:04PM +0530, jagdish eashwar wrote:
> Hi,
> I am trying to retrieve into an array a list of values from a column
> in a table using dbic and have it displayed in a drop down list in a
> tt2 template. I am able to do the retrieval part, but the tt2 template
> is displaying only the last value from the array. With further
> experimentation, I found that if I explicitly assign an array to a
> stash ( like '$c->stash->{myoptions} = [qw/1 2 3 4 5 6 7/];' ), I am
> getting all the 7 values in the tt2 template drop down. But if I
> define the array first and then assign it to the stash, ( like 'my
> @options = qw/1 2 3 4 5 6 7/; $c->stash->{myoptions} = @options;) I am
> getting only the last value in the tt2 template. How can I get all the
> values in the array into the stash without having to do it explicitly?

 $c->stash->{myoptions} = \@options;

 perldoc perlreftut
-- 
Lars Balker Rasmussen                                        Consult::Perl



More information about the Catalyst mailing list