Perl resources, modules, and sample code

Two apps, one server

Friday, 25 March 2011—subject to ongoing, unnanounced updates

Modern Perl Modern Perl at Powell’s, Modern Perl at Barnes and Noble, Modern Perl at Amazon.com, or download Modern Perl for free and then recommend it to your friends, write a great review, or otherwise spread the word.

Ew… Really?

Set it up–

catalyst.pl One
#...
catalyst.pl Two
#...

Same dir–

#!/usr/bin/env perl
# file: multi.psgi
use warnings;
use strict;
use Plack::Builder;
use One;
use Two;

my $app = builder {
    mount "/two" => Two->psgi_app(@_);
    mount "/" => One->psgi_app(@_);
};

Run the server–

plackup -IOne/lib -ITwo/lib multi.psgi

Now you’re good to visit and compare http://localhost:5000/ and http://localhost:5000/two/.