Commit | Line | Data |
fc7ec1d9 |
1 | NAME |
2 | Catalyst - The Elegant MVC Web Application Framework |
3 | |
4 | SYNOPSIS |
5 | # use the helper to start a new application |
d01df17d |
6 | catalyst.pl MyApp |
fc7ec1d9 |
7 | cd MyApp |
8 | |
9 | # add models, views, controllers |
f56990fa |
10 | script/myapp_create.pl model Something |
11 | script/myapp_create.pl view Stuff |
12 | script/myapp_create.pl controller Yada |
fc7ec1d9 |
13 | |
14 | # built in testserver |
f56990fa |
15 | script/myapp_server.pl |
fc7ec1d9 |
16 | |
17 | # command line interface |
f56990fa |
18 | script/myapp_test.pl /yada |
fc7ec1d9 |
19 | |
fc7ec1d9 |
20 | use Catalyst; |
21 | |
22 | use Catalyst qw/My::Module My::OtherModule/; |
23 | |
24 | use Catalyst '-Debug'; |
25 | |
26 | use Catalyst qw/-Debug -Engine=CGI/; |
27 | |
4be6aea7 |
28 | sub default : Private { $_[1]->res->output('Hello') } ); |
29 | |
30 | sub index : Path('/index.html') { |
31 | my ( $self, $c ) = @_; |
32 | $c->res->output('Hello'); |
6f6e1bb4 |
33 | $c->forward('foo'); |
4be6aea7 |
34 | } |
35 | |
6f6e1bb4 |
36 | sub product : Regex('^product[_]*(\d*).html$') { |
4be6aea7 |
37 | my ( $self, $c ) = @_; |
38 | $c->stash->{template} = 'product.tt'; |
39 | $c->stash->{product} = $c->req->snippets->[0]; |
40 | } |
fc7ec1d9 |
41 | |
92af75fc |
42 | See also Catalyst::Manual::Intro |
43 | |
fc7ec1d9 |
44 | DESCRIPTION |
fc7ec1d9 |
45 | The key concept of Catalyst is DRY (Don't Repeat Yourself). |
46 | |
47 | See Catalyst::Manual for more documentation. |
48 | |
4be6aea7 |
49 | Catalyst plugins can be loaded by naming them as arguments to the "use |
50 | Catalyst" statement. Omit the "Catalyst::Plugin::" prefix from the |
51 | plugin name, so "Catalyst::Plugin::My::Module" becomes "My::Module". |
fc7ec1d9 |
52 | |
53 | use Catalyst 'My::Module'; |
54 | |
4be6aea7 |
55 | Special flags like -Debug and -Engine can also be specifed as arguments |
56 | when Catalyst is loaded: |
fc7ec1d9 |
57 | |
58 | use Catalyst qw/-Debug My::Module/; |
59 | |
60 | The position of plugins and flags in the chain is important, because |
4be6aea7 |
61 | they are loaded in exactly the order that they appear. |
fc7ec1d9 |
62 | |
4be6aea7 |
63 | The following flags are supported: |
fc7ec1d9 |
64 | |
4be6aea7 |
65 | -Debug |
66 | enables debug output, i.e.: |
fc7ec1d9 |
67 | |
4be6aea7 |
68 | use Catalyst '-Debug'; |
69 | |
70 | this is equivalent to: |
71 | |
72 | use Catalyst; |
73 | sub debug { 1 } |
fc7ec1d9 |
74 | |
4be6aea7 |
75 | -Engine |
76 | Force Catalyst to use a specific engine. Omit the |
77 | "Catalyst::Engine::" prefix of the engine name, i.e.: |
fc7ec1d9 |
78 | |
4be6aea7 |
79 | use Catalyst '-Engine=CGI'; |
fc7ec1d9 |
80 | |
4be6aea7 |
81 | METHODS |
82 | debug |
83 | Overload to enable debug messages. |
fc7ec1d9 |
84 | |
4be6aea7 |
85 | config |
86 | Returns a hashref containing your applications settings. |
87 | |
88 | $c->engine |
89 | Contains the engine class. |
90 | |
91 | $c->log |
92 | Contains the logging object. Unless it is already set Catalyst sets |
93 | this up with a "Catalyst::Log" object. To use your own log class: |
94 | |
95 | $c->log( MyLogger->new ); |
96 | $c->log->info("now logging with my own logger!"); |
97 | |
98 | Your log class should implement the methods described in the |
99 | "Catalyst::Log" man page. |
fc7ec1d9 |
100 | |
6f6e1bb4 |
101 | $c->plugin( $name, $class, @args ) |
102 | Instant plugins for Catalyst. Classdata accessor/mutator will be |
103 | created, class loaded and instantiated. |
104 | |
105 | MyApp->plugin( 'prototype', 'HTML::Prototype' ); |
106 | |
107 | $c->prototype->define_javascript_functions; |
d1a31ac6 |
108 | |
f56990fa |
109 | CASE SENSITIVITY |
110 | By default Catalyst is not case sensitive, so "MyApp::C::FOO::Bar" |
111 | becomes "/foo/bar". |
112 | |
113 | But you can activate case sensitivity with a config parameter. |
114 | |
115 | MyApp->config->{case_sensitive} = 1; |
116 | |
6f6e1bb4 |
117 | LIMITATIONS |
118 | mod_perl2 support is considered experimental and may contain bugs. |
d1a31ac6 |
119 | |
92af75fc |
120 | SUPPORT |
121 | IRC: |
122 | |
123 | Join #catalyst on irc.perl.org. |
124 | |
125 | Mailing-Lists: |
126 | |
127 | http://lists.rawmode.org/mailman/listinfo/catalyst |
128 | http://lists.rawmode.org/mailman/listinfo/catalyst-dev |
4be6aea7 |
129 | |
6f6e1bb4 |
130 | Web: |
131 | |
132 | http://catalyst.perl.org |
133 | |
fc7ec1d9 |
134 | SEE ALSO |
4be6aea7 |
135 | Catalyst::Manual - The Catalyst Manual |
136 | Catalyst::Engine - Core Engine |
137 | Catalyst::Log - The Log Class. |
138 | Catalyst::Request - The Request Object |
139 | Catalyst::Response - The Response Object |
140 | Catalyst::Test - The test suite. |
fc7ec1d9 |
141 | |
4e449be9 |
142 | CREDITS |
143 | Andy Grundman |
144 | |
145 | Andrew Ford |
146 | |
147 | Andrew Ruthven |
148 | |
149 | Autrijus Tang |
150 | |
151 | Christian Hansen |
152 | |
153 | Christopher Hicks |
154 | |
155 | Dan Sully |
156 | |
157 | Danijel Milicevic |
158 | |
159 | David Naughton |
160 | |
161 | Gary Ashton Jones |
162 | |
163 | Geoff Richards |
164 | |
165 | Jesse Sheidlower |
166 | |
167 | Jody Belka |
168 | |
169 | Johan Lindstrom |
170 | |
171 | Juan Camacho |
172 | |
173 | Leon Brocard |
174 | |
175 | Marcus Ramberg |
176 | |
177 | Matt S Trout |
178 | |
179 | Robert Sedlacek |
180 | |
181 | Sebastian Riedel |
182 | |
183 | Tatsuhiko Miyagawa |
184 | |
185 | Ulf Edvinsson |
186 | |
fc7ec1d9 |
187 | AUTHOR |
188 | Sebastian Riedel, "sri@oook.de" |
189 | |
fc7ec1d9 |
190 | LICENSE |
191 | This library is free software . You can redistribute it and/or modify it |
192 | under the same terms as perl itself. |
193 | |