stash and arrays

23 views
Skip to first unread message

amka...@gmail.com

unread,
May 1, 2017, 5:03:33 AM5/1/17
to Mojolicious
Hi,

I need to pass an array to my template and I dont know how to do it.

Can please someone help me ?

Thanks   :)


Hyungsuk Hong

unread,
May 1, 2017, 5:16:00 AM5/1/17
to mojol...@googlegroups.com

hi,

# controller
my @arr = qw/foo bar/;
$self->stash(arr => \@arr);

# template
%= $arr->[0];    # foo

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscribe@googlegroups.com.
To post to this group, send email to mojol...@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Hyungsuk Hong

unread,
May 1, 2017, 5:19:29 AM5/1/17
to mojol...@googlegroups.com

amka...@gmail.com

unread,
May 1, 2017, 5:41:40 AM5/1/17
to Mojolicious

Thanks  :)
Reply all
Reply to author
Forward
0 new messages