Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^5: first steps with Mojolicious::Lite -- under

by shmem (Chancellor)
on Jun 16, 2020 at 12:31 UTC ( [id://11118133]=note: print w/replies, xml ) Need Help??


in reply to Re^4: first steps with Mojolicious::Lite -- under
in thread first steps with Mojolicious::Lite

Once the under() sub is compiled, all following get() and post() etc calls get compiled as calling this under() sub first.

So

under sub { validate_cookie() }; get "/foo" => sub { my $c = shift; ... }; get "/bar" => sub { my $c = shift; ... };

is equivalent to

get "/foo" => sub { validate_cookie() or return; my $c = shift; ... }; get "/bar" => sub { validate_cookie() or return; my $c = shift; ... };
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11118133]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-23 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found