[tpm] Mojolicious::Lite <-> Full Mojolicious
Zoffix Znet
zoffixznet at gmail.com
Wed Oct 28 20:19:28 PDT 2015
Hey,
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:
https://metacpan.org/pod/Mojolicious::Guides::Growing )
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:
https://metacpan.org/source/SRI/Mojolicious-6.26/lib/Mojolicious/Lite.pm
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!
Cheers,
ZZ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20151028/6c786142/attachment.html>
More information about the toronto-pm
mailing list