in reply to Anonymous sub clarification
As LanX said, it's just a parenthesis-less method call to "get". "=>" is often called a "fat comma" in Perl; but more over it's like passing an anonymous hash to the "get" method as implemented by Mojo.
IOW, it's also equivalent to the following where "/" is the hash key and anonymous subroutine is the hash value:
IOW, it's also equivalent to the following where "/" is the hash key and anonymous subroutine is the hash value:
And for that matter,my $hash_ref = { '/' => sub {...} }; get($hash_ref);
Ultimately, you are associating the subroutine handler for the URL; in this case, "/".my $array_ref = [ '/', sub {...} ]; get($array_ref);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Anonymous sub clarification
by haukex (Archbishop) on Jul 21, 2016 at 17:37 UTC | |
by perlfan (Vicar) on Jul 22, 2016 at 15:44 UTC |
In Section
Seekers of Perl Wisdom