[Catalyst] using Catalyst with legacy cgi scripts

Ton Voon ton.voon at altinity.com
Fri Dec 7 17:03:25 GMT 2007


Hi Gerda,

On 7 Dec 2007, at 16:27, Gerda Shank wrote:

> I'm developing some new parts of our web application in Catalyst,  
> but when it comes time to deploy it will have to coexist with a  
> bunch of legacy Perl cgi scripts. Eventually I'd like to replace  
> them all, but it will have to be done piece by piece.
>
> The current system runs on Apache, with just CGI, and we will be  
> switching to FastCGI (probably). Some parts of it (the help system)  
> are purely static, but most of it is dynamically constructed (lists  
> of today's papers, etc.)
>
> What would be "best practice" for deploying this mess together? It  
> seems like I would have to skip the Catalyst routing altogether for  
> the cgi scripts, right?

One approach is to get Apache to serve your CGIs directly and use a  
different path for the Catalyst app.

Another, is to get Catalyst to deliver the CGIs. For Opsview (http://opsview.org 
), we wanted to wrap Nagios' CGIs to make it work like normal Catalyst  
pages (with sidenavs, footers and ajax updates). So we used this  
wrapping technique which runs the CGI, grabs the output, puts it back  
into the stash for us to then manipulate before rendering it in the  
view.

I would say to use this wrapping technique if there is something  
special you want to do to the CGIs and you don't have much control  
over the original CGI code.

This was originally written for us by Shadowcat, but we've agreed to  
publishing it and Matt has placed it as CatalystX::Controller::WrapCGI  
on the Catalyst svn tree: http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Controller-WrapCGI/

I've offered to Matt, offlist, that I'd be willing to spend the time  
on polishing this module up for CPAN release. If there's interest  
here, that will sway the decision.

Ton

http://www.altinity.com
UK: +44 (0)870 787 9243
US: +1 866 879 9184
Fax: +44 (0)845 280 1725
Skype: tonvoon




More information about the Catalyst mailing list