[Catalyst] difficulty in assigning an array to a stash

Andy Grundman andy at hybridized.org
Sun Nov 11 16:37:47 GMT 2007


On Nov 11, 2007, at 11:28 AM, 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;



More information about the Catalyst mailing list