[tpm] Mojolicious::Lite <-> Full Mojolicious
zoffixznet at gmail.com
Wed Oct 28 20:19:28 PDT 2015
During tonight's talk, a question came up about how do we get
from ::Lite apps to full Mojolicious apps (I believe the person's name
was Alan; apologies, if I'm wrong)
Just wanted to add to what was said at the meeting:
First, there's the "Growing" Guide that talks about the process of
converting the ::Lite to Full (here:
Second, the most important thing to keep in mind is that ::Lite apps are
just full apps with some sugar on top. ::Lite refers to the "lightness"
of how it's used, not the available functionality.
Take a look at the source code of Mojolicious::Lite:
As you can see, its base class is the full Mojolicious class, and on
->import (when ::Lite is `use`d), just some syntactic sugar is monkey
patched into the caller to make subs like `app`, `get`, and others do
something useful. Under the hood, the full Mojolicious app handles all
the dirty work.
Also, as part of my learning process, I often simply used
Acme::Dump::And::Dumper to dump a variable or return value in question
to see what object it was and then went and read the docs on what
methods it offered. Be keen to notice any of the "..inherits all methods
from blah blah" in the docs as many of the classes are subclasses of
others. A lot of times, you'll find the variable in question contains
your Mojolicious::Controller and you just take it from there.
Hope that helps!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the toronto-pm