MVC Apps with Catalyst
- With Catalyst, controller code is all Perl
package MyApp::Controller::User;
use base 'Catalyst::Controller';
sub view : Path('/user') : Args(1) {
my ($self, $c, $user_id) = @_;
$c->stash()->{user} =
MyApp::User->new( user_id => $user_id );
# this will be a Mason template
$c->stash()->{template} = '/user/view';
}
sub create_form : Path { ... }
- Go to /user/42, /user/create_form
- Catalyst can use Mason for views
- Please use Catalyst!