Your SlideShare is downloading. ×
0
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Mojolicious: what works and what doesn't

3,707

Published on

A brief summary of our first month experience using Mojolicious: what worked and what didn't work. …

A brief summary of our first month experience using Mojolicious: what worked and what didn't work.

Taken from the Oslo Perl Mongers talk given October 5th, 2011

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,707
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
13
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Mojolicious: what works and what doesnt v1 - october 2011 cosimo@opera.com
  • 2. What is Mojolicious? http://lmgtfy.org/?q=Mojolicious
  • 3. What is Mojolicious?• Web framework• “New wave” of light-weight Ruby-inspired f.• WSGI -> PSGI• Includes Plack, Dancer, Mojolicious, ...
  • 4. How to define a framework?• Request lifecycle• Features? ORM, Templating, I18N, Forms, Layout, ...• Testing?• Deployment: deps? Stand-alone servers? (starman, hypnotoad, ...)• Documentation?• ... what else?
  • 5. Lets look at Dancer• Excellent documentation https://metacpan.org/module/Dancer::Introduction• DSL and script oriented use Dancer; get /login => sub { # do something }; any [get, post] => /login/verify => sub { # do something }
  • 6. Lets look at Dancer / 2Too much DSL oriented?before sub { if (!session(user) && request->path_info !~m{^/login}) { # Pass the original path along to the handler: var requested_path => request->path_info; request->path_info(/login); }};
  • 7. Compare with Mojolicioususe base Mojolicious;sub startup { my $self = shift; $self->hook(before_dispatch => sub { my $c = shift; if(!$c->session(user) && $c->stash(action)!~/^login/) { $c->stash(action) = login; } });}... except whole example would be pointless in Mojolicious because of named routes
  • 8. Compare with Mojolicioususe base Mojolicious;sub startup { my $self = shift; $self->sessions->cookie_name(auth_session); $self->sessions->default_expiration(7200); $self->plugin(I18N => (namespace => Auth::Locale)); $self->renderer->default_handler(tt); my $r = $self->routes; $r->route(/login)->to(login#index); $r->route(/login/verify)->to(login#verify); $self->hook(before_dispatch => sub { do($something) });}
  • 9. Differences, Mojo vs Dancer• Application is a class, not a script• Code is “natural”. No magic. Obvious.• Mojo Routes are awesome. Really.• Hooks are similar, but PLA/POLS rules• ... what else?
  • 10. What works?• Good docs. Need more meaningful examples.• Fast feedback on IRC #mojo (irc.perl.org)• Routes! Best of Perl and non-Perl frameworks• Extensive test suite• Clear no deps policy
  • 11. What doesnt work?or rather, the most annoying problems I found• No deps policy (cookie parsing)• Tons of tests, but are they relevant? (cookie parsing and generations tests again)• Template Toolkit renderer (c.* prefix)
  • 12. Thanks! Questions?

×