Hey Jim,
I fooled around with Mason on Catalyst and asked basically the same
question on the Catalyst mailing group, I copied the one response that
worked for me(its based on the tutorial for Catalyst):
<email>
Hiya Justin et al,
I used to use TT2 about 5 years ago, but switched to mason about 3 years
ago. One of the better choices I've made IMHO. For catalyst, its setup
is straightforward:
create lib/MyApp/View/Mason.pm and within it, put one line to define the
temporary directory where apache will put its object files. I use an
application-specific directory since I have a number of different
catalyst apps and the mason defaults will clobber each other otherwise:
package MyApp::View::Mason;
use strict;
use base 'Catalyst::View::Mason';
__PACKAGE__->config->{data_dir} = "/workplace/MyApp/data";
1;
And then in lib/MyApp/Controller/Root.pm, I put a default subby like the
following which will serve any page out of the root/ directory as a
mason component. That way I don't have to keep defining controllers for
everything when I want to put most of my development application logic
in mason components anyway (that way I don't have to keep reloading
apache on HUGE applications that catalyst takes forever to load as a cgi):
sub default : Private {
my ( $self, $c ) = @_;
# what directory our default mason components are in:
my $f = $c->path_to('root', @{$c->req->args});
if ( -f $f ) {
$c->stash->{template} = $f->relative($c->path_to('root')) ."";
$c->forward("MyApp::View::Mason");
}
}
I have an override in apache for root/static for all those unprotected
things I don't want catalyst to touch, like dojo, yui, images, css, etc.
The use of lib/MyApp/Controller/Root.pm suggests a more recent version
of Catalyst. If you dont have a root controller, it's time to upgrade.
$c is available in every mason component, and so is $m like normal. Hope
that helps. Glad to see not everyone is drinking the TT2 kool-aid :-)
:goose
</email>
Hope this helps - it worked for me.
Justin
Jimbus wrote:
> I'm trying to do Catalyst and want to stay with Mason and I'm trying
> to pick up DBIC and MVC... but I'm getting a bit overwhelmed. I'm
> having a hard time with the tutorial separating whats
> Catalyst/TT2/DBIC... are there helper scripts for Mason... that sort
> of thing.
>
> If anyone has a link to a Catalyts/Mason tutorial, I'd be grateful. If
> anyone knew of a good primer on DBIC, that'd help. too.
>
> Thanks,
>
>
> --
> Jim Babcock
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> jimbus.net
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mason-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mason-users
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users