Files
fission-src/examples/perl/hello.pm
T
Moritz Grosch (LittleFox)andSoam Vasani 6142ac3648 Added perl environment (#311)
Perl runtime environment and example function.
2017-09-07 23:42:40 -07:00

19 lines
511 B
Perl

=pod
You return a CODEREF from the package that will be called as your function.
The code in the server is something like this (simplified):
my $sub = require('hello.pm');
$sub->(request);
As you can see, you get the L<Dancer2::Core::Request> object as first argument
to your function. You can use it to retrieve params given to your function or
anything else Dancer2 offers. You can also use Dancer2 and use its DSL.
=cut
return sub {
return 'Hello, ' . (shift->param('name') // 'world');
};