cd
mkdir pm-1116108
cd pm-1116108
mkdir cgi
####
catalyst.pl MyCatalystApp
##
##
##
##
#!/usr/bin/env perl
use strictures;
use CGI qw(:standard);
print header(),
start_html("HAI"),
h1("DERP!"),
end_html();
##
##
use Mojolicious::Lite;
get '/' => sub {
my $c = shift;
$c->render(text => "OHAI!");
};
app->start;
##
##
use strictures;
use utf8;
use Plack::Builder;
use Encode;
require Mojo::Server::PSGI;
require Plack::App::CGIBin;
require Plack::App::WrapCGI;
use lib "./MyCatalystApp/lib";
require MyCatalystApp;
my $root = sub {
[ 200,
[ "Content-Type" => "text/plain; charset=utf-8" ],
[ encode_utf8("I \x{2763} Plack::Builder") ] ];
};
my $cat_app = MyCatalystApp->psgi_app;
my $mojo_app = eval {
my $server = Mojo::Server::PSGI->new;
$server->load_app("./mojo-hello.pl");
$server->to_psgi_app;
};
my $cgi_app = Plack::App::CGIBin
->new( root => "./cgi" )
->to_app;
my $php = Plack::App::WrapCGI
->new( script => "/usr/bin/php ./hello.php",
execute => 1 )
->to_app;
builder {
enable "Rewrite", rules => sub {
s,(?<=/cat)\z,/,; # Add trailing slash for Cat app’s root.
};
mount "/cat" => $cat_app;
mount "/mojo" => $mojo_app;
mount "/cgi" => $cgi_app;
mount "/php" => $php;
mount "/" => $root;
};
__END__
##
##
env CATALYST_DEBUG=0 plackup -r
Watching ./lib pm-1116108.psgi for file updates.
HTTP::Server::PSGI: Accepting connections at http://0:5000/