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

Garrett Goebel ggoebel at goebel.ws
Sat Apr 28 17:28:38 GMT 2007


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:

my $r = $c->request  if $backend eq 'catalyst';

$r and $c->request were similar enough that this worked for me. Your  
milage may vary.



On Apr 28, 2007, at 5:15 AM, Marc Espie wrote:

> Couldn't find any simple guide to that, so I was wondering if someone
> had done it already.
> I have a somewhat big HTML::Mason `classic' web-site, with web pages
> that include all kinds of Mason components.
> I'd like to migrate all of that to Catalyst, but it's not going to  
> happen
> overnight, and the application must keep running.
> So I was wondering if there was any guide to this kind of `inside-out'
> refactoring.
> Specifically, I see how I can get the Mason app coexisting with  
> Catalyst
> stuff, I also have a plan to migrate the DBI glue to DBIx::Class,  
> but I
> would like to keep using the Mason infrastructure for now, and by able
> to invoke catalyst parts as Mason components, e.g., a web page served
> by mason:
> some static content...
> some mason stuff.
> <& invoke/some/external_compoent /&>
>    ^
>    |
> what should I put to be able to have part of my catalyst app there ?
> I understand it will require having two views (full catalyst app, and
> html fragments for HTML::Mason), but I don't see how to run the  
> controller
> from Mason...
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/ 
> catalyst at lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

More information about the Catalyst mailing list