Rendering templates question

22 views
Skip to first unread message

Stefan Adams

unread,
Oct 4, 2019, 1:33:41 PM10/4/19
to mojolicious
In Mojolicious::Guides::Render#Embedded-Perl, it says:

At the beginning of the template, stash values that don't have invalid characters in their name get automatically initialized as normal variables, and the controller object as both $self and $c.

How are stash values initialized as normal variables?  That is, what code is responsible for making this happen?

Dan Book

unread,
Oct 4, 2019, 3:10:07 PM10/4/19
to mojol...@googlegroups.com
Mojolicious::Plugin::EPRenderer passes the stash as args to Mojo::Template, which has the vars option enabled and thus creates variables based on the passed hash.

-Dan

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/CACyQ%2BFSdKdJ15sPUTv19N3U7wc81O%3D7hv4i-kk%2BJ%3D_9Q%2BUd7Cw%40mail.gmail.com.

Stefan Adams

unread,
Oct 4, 2019, 4:15:52 PM10/4/19
to mojolicious
Got it!  Your answer helped me to track down the code block I was looking for: Mojo::Template::_wrap().

I was just curious how it works.  Thank you!

Reply all
Reply to author
Forward
0 new messages