In Template Toolkit there’s the RETURN directive which can be used to stop processing the current template and return to the template from which it was called. How can I do this in Mojolicious?
In Template Toolkit there’s the RETURN directive which can be used to stop processing
Share
Based on the documentation saying templates work just like Perl subs (actually they get compiled to a Perl sub internally) I did some experiments. It appears that a simple
returns from a template discarding all its output. And
returns from a template and keeps all its output generated before the return statement.
Please note that these are unofficial hacks. To find more possibilities to interact with Mojolicious internals you can try
in your template and see the output and discover pretty much everything that is happening in the compiled templates.