epoch1 has asked for the wisdom of the Perl Monks concerning the following question:
I'm just working my way through some Mojolicious tutorials. Can someone tell me what the => 'index' is doing after the anonymous subroutine please? I know it's telling Mojolicious to look for a template called 'index' but why is it written in this way rather than $c->render(template => 'index') inside the sub?
Thanks.get '/' => sub my $c = shift; $c->render; } => 'index';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Anonymous sub clarification (fat comma)
by LanX (Saint) on Jul 16, 2016 at 21:21 UTC | |
by epoch1 (Acolyte) on Jul 17, 2016 at 17:12 UTC | |
|
Re: Anonymous sub clarification
by AnomalousMonk (Archbishop) on Jul 16, 2016 at 22:42 UTC | |
|
Re: Anonymous sub clarification
by perlfan (Parson) on Jul 21, 2016 at 14:59 UTC | |
by haukex (Archbishop) on Jul 21, 2016 at 17:37 UTC | |
by perlfan (Parson) on Jul 22, 2016 at 15:44 UTC |