2 Catalyst - The Elegant MVC Web Application Framework
5 # use the helper to start a new application
9 # add models, views, controllers
10 script/create.pl model Something
11 script/create.pl view Stuff
12 script/create.pl controller Yada
17 # command line interface
22 use Catalyst qw/My::Module My::OtherModule/;
24 use Catalyst '-Debug';
26 use Catalyst qw/-Debug -Engine=CGI/;
28 sub default : Private { $_[1]->res->output('Hello') } );
30 sub index : Path('/index.html') {
31 my ( $self, $c ) = @_;
32 $c->res->output('Hello');
36 sub product : Regex('/^product[_]*(\d*).html$/') {
37 my ( $self, $c ) = @_;
38 $c->stash->{template} = 'product.tt';
39 $c->stash->{product} = $c->req->snippets->[0];
42 See also Catalyst::Manual::Intro
45 Catalyst is based upon Maypole, which you should consider for smaller
48 The key concept of Catalyst is DRY (Don't Repeat Yourself).
50 See Catalyst::Manual for more documentation.
52 Catalyst plugins can be loaded by naming them as arguments to the "use
53 Catalyst" statement. Omit the "Catalyst::Plugin::" prefix from the
54 plugin name, so "Catalyst::Plugin::My::Module" becomes "My::Module".
56 use Catalyst 'My::Module';
58 Special flags like -Debug and -Engine can also be specifed as arguments
59 when Catalyst is loaded:
61 use Catalyst qw/-Debug My::Module/;
63 The position of plugins and flags in the chain is important, because
64 they are loaded in exactly the order that they appear.
66 The following flags are supported:
69 enables debug output, i.e.:
71 use Catalyst '-Debug';
73 this is equivalent to:
79 Force Catalyst to use a specific engine. Omit the
80 "Catalyst::Engine::" prefix of the engine name, i.e.:
82 use Catalyst '-Engine=CGI';
86 Overload to enable debug messages.
89 Returns a hashref containing your applications settings.
92 Contains the engine class.
95 Contains the logging object. Unless it is already set Catalyst sets
96 this up with a "Catalyst::Log" object. To use your own log class:
98 $c->log( MyLogger->new );
99 $c->log->info("now logging with my own logger!");
101 Your log class should implement the methods described in the
102 "Catalyst::Log" man page.
107 Join #catalyst on irc.perl.org.
111 http://lists.rawmode.org/mailman/listinfo/catalyst
112 http://lists.rawmode.org/mailman/listinfo/catalyst-dev
115 Catalyst::Manual - The Catalyst Manual
116 Catalyst::Engine - Core Engine
117 Catalyst::Log - The Log Class.
118 Catalyst::Request - The Request Object
119 Catalyst::Response - The Response Object
120 Catalyst::Test - The test suite.
123 Sebastian Riedel, "sri@oook.de"
126 Andrew Ford, Andrew Ruthven, Christian Hansen, Christopher Hicks, Dan
127 Sully, Danijel Milicevic, David Naughton, Gary Ashton Jones, Jesse
128 Sheidlower, Johan Lindstrom, Marcus Ramberg, Tatsuhiko Miyagawa and all
129 the others who've helped.
132 This library is free software . You can redistribute it and/or modify it
133 under the same terms as perl itself.