[Catalyst] Squatting::On::Catalyst

John Beppu john.beppu at gmail.com
Mon Jul 28 16:27:27 BST 2008


Squatting is a web microframework for Perl that's based on Camping from the
Ruby world.  During the transition from Ruby to Perl, Squatting gained some
mutant powers which is why I'm writing to you today.

One of Squatting's mutant powers is its ability to embed itself into other
frameworks (like Catalyst).  You can take whole Squatting apps, and embed
them into your existing web application with just a few lines of glue code.
Allow me to demonstrate.

STEP 1:  Install Pod::Server from CPAN.

$ sudo cpan Pod::Server

STEP 2:  Run Pod::Server so you can see what it looks like.

$ squatting Pod::Server -p 8088


$ pod_server

Then, visit http://localhost:8088/ and pay attention to the URLs as you
click around.  (This will be interesting when you see how the URLs of the
whole site will be "relocated" later on in the demonstration.)

STEP 3:  Create a Catalyst application.

$ catalyst.pl Propaganda

STEP 4:  Embed Pod::Server into the Catalyst application.

$ cd Propaganda
$ $EDITOR lib/Propaganda/Controller/Root.pm

Then, add the following lines of code to an appropriate place in the

use Pod::Server 'On::Catalyst';
$Pod::Simple::HTML::Perldoc_URL_Prefix =3D '/pod/';
sub pod : Local { Pod::Server->catalyze($_[1]) }

STEP 5: Start up the Catalyst application.

$ script/propaganda_server.pl

Finally, visit http://localhost:3000/pod/ .  If everything worked, you
should see that Pod::Server has just been embedded into a Catalyst

*What Are The Implications of This?*

Right now, anyone who is developing a web app with Catalyst can install
Pod::Server from CPAN and embed it directly into their web app.  However,
this is just the beginning.

Imagine if you could install a blog, a wiki, a forum, or a store just as

Imagine adding major functionality to any Perl-based site with ~5 lines of

Squatting makes modular web applications both possible and probable.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20080728/8f6f3=

More information about the Catalyst mailing list