Catalyst

Catalyst is a Perl module that contains the elegant MVC web application framework.
Download

Catalyst Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Sebastian Riedel
  • Publisher web site:
  • http://search.cpan.org/~mramberg/Catalyst-View-PSP-0.01/lib/Catalyst/Helper/View/PSP.pm

Catalyst Tags


Catalyst Description

Catalyst is a Perl module that contains the elegant MVC web application framework. Catalyst is a Perl module that contains the elegant MVC web application framework.SYNOPSISSee the Catalyst::Manual distribution for comprehensive documentation and tutorials. # Install Catalyst::Devel for helpers and other development tools # use the helper to create a new application catalyst.pl MyApp # add models, views, controllers script/myapp_create.pl model MyDatabase DBIC::Schema create=dynamic dbi:SQLite:/path/to/db script/myapp_create.pl view MyTemplate TT script/myapp_create.pl controller Search # built in testserver -- use -r to restart automatically on changes # --help to see all available options script/myapp_server.pl # command line testing interface script/myapp_test.pl /yada ### in lib/MyApp.pm use Catalyst qw/-Debug/; # include plugins here as well ### In lib/MyApp/Controller/Root.pm (autocreated) sub foo : Global { # called for /foo, /foo/1, /foo/1/2, etc. my ( $self, $c, @args ) = @_; # args are qw/1 2/ for /foo/1/2 $c->stash->{template} = 'foo.tt'; # set the template # lookup something from db -- stash vars are passed to TT $c->stash->{data} = $c->model('Database::Foo')->search( { country => $args } ); if ( $c->req->params->{bar} ) { # access GET or POST parameters $c->forward( 'bar' ); # process another action # do something else after forward returns } } # The foo.tt TT template can use the stash data from the database # called for /bar/of/soap, /bar/of/soap/10, etc. sub bar : Path('/bar/of/soap') { ... } # called for all actions, from the top-most controller downwards sub auto : Private { my ( $self, $c ) = @_; if ( !$c->user_exists ) { # Catalyst::Plugin::Authentication $c->res->redirect( '/login' ); # require login return 0; # abort request and go immediately to end() } return 1; # success; carry on to next action } # called after all actions are finished sub end : Private { my ( $self, $c ) = @_; if ( scalar @{ $c->error } ) { ... } # handle errors return if $c->res->body; # already have a response $c->forward( 'MyApp::View::TT' ); # render template } ### in MyApp/Controller/Foo.pm # called for /foo/bar sub bar : Local { ... } # called for /blargle sub blargle : Global { ... } # an index action matches /foo, but not /foo/1, etc. sub index : Private { ... } ### in MyApp/Controller/Foo/Bar.pm # called for /foo/bar/baz sub baz : Local { ... } # first Root auto is called, then Foo auto, then this sub auto : Private { ... } # powerful regular expression paths are also possible sub details : Regex('^product/(w+)/details$') { my ( $self, $c ) = @_; # extract the (w+) from the URI my $product = $c->req->captures->; }Requirements:· Perl Requirements: · Perl


Catalyst Related Software