Mojolicious :: Lite
put the module:
cpan Mojolicious :: Lite
create a script:
! / usr / bin / perl
use strict;
use warnings;
use Mojolicious :: Lite;
get '/' => sub {
my $ self = shift;
$ self-> render (text => 'It works!');
};
shagadelic;run:perl ./mojolitetest.pl daemonthat’s all, open http: // localhost: 3000 / in the browser and enjoy)
but that’s not all I wanted to show, of course you can use the templates directly in the same script:
! / usr / bin / perl
use strict;
use warnings;
use Mojolicious :: Lite;
get '/' => sub {
my $ self = shift;
$ self-> render (text => 'It works!');
};
get '/ foo' => sub {
my $ self = shift;
$ self-> render (template => 'foo');
};
shagadelic;
__DATA__
@@ foo.html.eplite
It's from template!we run the script and at http: // localhost: 3000 / foo we see: “It's from template!”
more information on the module page