I'm new at using Mojolicious and therefore I apologize if this is a basic question but I looked around and couldn't find a good way to do it.
I would like to know what's the best strategy to share the name of form parameters between the Perl code (to be used in param('element') and a template (to be used in say INPUT name="element" ...>. Is there a way to define 'element' somewhere so that it can be used in both the Perl side and the template side? A super global variable?
Thanks in advance!
if i understand you correct then
stash
- is answer for your question.https://metacpan.org/pod/Mojolicious::Controller#stash
Example. In controller you have such code:
In template:
I think that more good way not exist.