-
Notifications
You must be signed in to change notification settings - Fork 0
Newbie notes
Sometimes a newcomer to Mojo* will be confused by some examples, or by the lack of some examples. If you're in such a situation, please describe your confusion here, so that the developers can close gaps in the documentation.
-
The Mojolicious::Lite doc doesn't seem to show how to pass variables from the controller to the template.
-
The word "stash" is used, but not explained, nor linked to in the docs. (Both in Mojolicious and Mojolicious::Lite).
-
The syntax errors in templates suck, because they don't show the generated Perl code
-
It took me forever to find the Mojolicious::Renderer, Mojolicious::Plugin::EpRenderer, and Mojolicious::Plugin::EplRenderer docs. It didn't occur to me to look for them in Mojolicious. I kept going back to Mojolicous::Guides::Rendering so can you add them to it as well?
-
Based on the docs, setting the mode in the startup method should be enough to turn off debug level logging.
$self->mode('production');
Yet after adding that every page access spews three lines:
debug Mojolicious::Plugin::RequestTimer:XXX debug Mojolicious::Routes:XXX debug Mojolicious::Plugin::RequestTimer:XXX
After much trial and error, the only way that I could consistently get the debug messages to go away was to set the MOJO_MODE environment variable in my script.
$ENV{MOJO_MODE} = 'production';
-
Mojo::Asset::File has method is_file that return always 1. I thought was a sort of verification about object, as a -f flag or a ISA test.
if ($file->is_file) { ... } # equivalent if (-f $file->path) { ... }
Maybe docs could to be more clear about it.
Coming from the cgi experience, the Mojolicious applications are persistent, they don't restart at each request. So:
-
Don't chdir
Changing directory will lead to unpredictable results as the whole application changes directory.
-
Don't die
Die is not something you want to depend on for normal workflow.
-
Tainting is not need
perl -T is pretty much pointless in mojolicious, since it parses everything.