[Catalyst] refactoring an existing HTML::Mason installation to use Catalyst

Matt S Trout dbix-class at trout.me.uk
Tue May 8 14:26:14 GMT 2007


On Sat, Apr 28, 2007 at 11:28:38AM -0500, Garrett Goebel wrote:
> Marc,
> 
> I just did the opposite for an old Mason site at work the other day.  
> I embedded mason pages in catalyst. I.e., I used  
> Catalyst::View::Mason and created a controller that forwarded all the  
> mason pages to it.
> 
> Because Catalyst::View::Mason uses Mason without Apache you won't  
> have access to $r. For my purposes this wasn't a big deal. As a quick  
> hack in my controller I put $c->stash->{backend} = 'catalyst'. Then  
> in the autohandler I dropped:
> 
> <%args>
> $backend
> </$args>
> my $r = $c->request  if $backend eq 'catalyst';
> 
> $r and $c->request were similar enough that this worked for me. Your  
> milage may vary.

$c->req is 'close enough' to Apache::Request, CGI or HTTP::Request objects.
This is handy.

If you're under mod_perl you can get at the Apache $r via $c->engine->apache
IIRC (but I'd try and avoid this if possible, one of the best things about
Cat migration for me is always being able to use the test server rather than
a full mod_perl dev rig)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
Shadowcat Systems Ltd.   Contact mst (at) shadowcatsystems.co.uk for a quote
                                          http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst mailing list