1dab41f0b3510e0db1460c85fef22c5ef5ffc8b0
[catagits/Gitalist.git] / local-lib5 / man / man3 / Catalyst::DispatchType::Chained.3pm
1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.3
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
12 ..
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
16 ..
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
21 ..
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
25 ..
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  | will give a
29 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
30 .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
32 .tr \(*W-|\(bv\*(Tr
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD.  Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
55 .if \nF \{\
56 .    de IX
57 .    tm Index:\\$1\t\\n%\t"\\$2"
58 ..
59 .    nr % 0
60 .    rr F
61 .\}
62 .\"
63 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
65 .hy 0
66 .if n .na
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101 .\}
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
117 \{\
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
127 .\}
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
130 .\"
131 .IX Title "Catalyst::DispatchType::Chained 3"
132 .TH Catalyst::DispatchType::Chained 3 "2009-09-02" "perl v5.8.7" "User Contributed Perl Documentation"
133 .SH "NAME"
134 Catalyst::DispatchType::Chained \- Path Part DispatchType
135 .SH "SYNOPSIS"
136 .IX Header "SYNOPSIS"
137 Path part matching, allowing several actions to sequentially take care of processing a request:
138 .PP
139 .Vb 5
140 \&  #   root action \- captures one argument after it
141 \&  sub foo_setup : Chained('/') PathPart('foo') CaptureArgs(1) {
142 \&      my ( $self, $c, $foo_arg ) = @_;
143 \&      ...
144 \&  }
145 .Ve
146 .PP
147 .Vb 5
148 \&  #   child action endpoint \- takes one argument
149 \&  sub bar : Chained('foo_setup') Args(1) {
150 \&      my ( $self, $c, $bar_arg ) = @_;
151 \&      ...
152 \&  }
153 .Ve
154 .SH "DESCRIPTION"
155 .IX Header "DESCRIPTION"
156 Dispatch type managing default behaviour.  For more information on
157 dispatch types, see:
158 .IP "* Catalyst::Manual::Intro for how they affect application authors" 4
159 .IX Item "Catalyst::Manual::Intro for how they affect application authors"
160 .PD 0
161 .IP "* Catalyst::DispatchType for implementation information." 4
162 .IX Item "Catalyst::DispatchType for implementation information."
163 .PD
164 .SH "METHODS"
165 .IX Header "METHODS"
166 .Sh "$self\->list($c)"
167 .IX Subsection "$self->list($c)"
168 Debug output for Path Part dispatch points
169 .ie n .Sh "$self\->match( $c\fP, \f(CW$path )"
170 .el .Sh "$self\->match( \f(CW$c\fP, \f(CW$path\fP )"
171 .IX Subsection "$self->match( $c, $path )"
172 Calls \f(CW\*(C`recurse_match\*(C'\fR to see if a chain matches the \f(CW$path\fR.
173 .ie n .Sh "$self\->recurse_match( $c\fP, \f(CW$parent, \e@path_parts )"
174 .el .Sh "$self\->recurse_match( \f(CW$c\fP, \f(CW$parent\fP, \e@path_parts )"
175 .IX Subsection "$self->recurse_match( $c, $parent, @path_parts )"
176 Recursive search for a matching chain.
177 .ie n .Sh "$self\->register( $c\fP, \f(CW$action )"
178 .el .Sh "$self\->register( \f(CW$c\fP, \f(CW$action\fP )"
179 .IX Subsection "$self->register( $c, $action )"
180 Calls register_path for every Path attribute for the given \f(CW$action\fR.
181 .ie n .Sh "$self\->uri_for_action($action, $captures)"
182 .el .Sh "$self\->uri_for_action($action, \f(CW$captures\fP)"
183 .IX Subsection "$self->uri_for_action($action, $captures)"
184 Get the \s-1URI\s0 part for the action, using \f(CW$captures\fR to fill
185 the capturing parts.
186 .Sh "$c\->expand_action($action)"
187 .IX Subsection "$c->expand_action($action)"
188 Return a list of actions that represents a chained action. See
189 Catalyst::Dispatcher for more info. You probably want to
190 use the expand_action it provides rather than this directly.
191 .SH "USAGE"
192 .IX Header "USAGE"
193 .Sh "Introduction"
194 .IX Subsection "Introduction"
195 The \f(CW\*(C`Chained\*(C'\fR attribute allows you to chain public path parts together
196 by their private names. A chain part's path can be specified with
197 \&\f(CW\*(C`PathPart\*(C'\fR and can be declared to expect an arbitrary number of
198 arguments. The endpoint of the chain specifies how many arguments it
199 gets through the \f(CW\*(C`Args\*(C'\fR attribute. \f(CW:Args(0)\fR would be none at all,
200 \&\f(CW\*(C`:Args\*(C'\fR without an integer would be unlimited. The path parts that
201 aren't endpoints are using \f(CW\*(C`CaptureArgs\*(C'\fR to specify how many parameters
202 they expect to receive. As an example setup:
203 .PP
204 .Vb 2
205 \&  package MyApp::Controller::Greeting;
206 \&  use base qw/ Catalyst::Controller /;
207 .Ve
208 .PP
209 .Vb 6
210 \&  #   this is the beginning of our chain
211 \&  sub hello : PathPart('hello') Chained('/') CaptureArgs(1) {
212 \&      my ( $self, $c, $integer ) = @_;
213 \&      $c\->stash\->{ message } = "Hello ";
214 \&      $c\->stash\->{ arg_sum } = $integer;
215 \&  }
216 .Ve
217 .PP
218 .Vb 5
219 \&  #   this is our endpoint, because it has no :CaptureArgs
220 \&  sub world : PathPart('world') Chained('hello') Args(1) {
221 \&      my ( $self, $c, $integer ) = @_;
222 \&      $c\->stash\->{ message } .= "World!";
223 \&      $c\->stash\->{ arg_sum } += $integer;
224 .Ve
225 .PP
226 .Vb 3
227 \&      $c\->response\->body( join "<br/>\en" =>
228 \&          $c\->stash\->{ message }, $c\->stash\->{ arg_sum } );
229 \&  }
230 .Ve
231 .PP
232 The debug output provides a separate table for chained actions, showing
233 the whole chain as it would match and the actions it contains. Here's an
234 example of the startup output with our actions above:
235 .PP
236 .Vb 9
237 \&  ...
238 \&  [debug] Loaded Path Part actions:
239 \&  .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-.
240 \&  | Path Spec             | Private                      |
241 \&  +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
242 \&  | /hello/*/world/*      | /greeting/hello (1)          |
243 \&  |                       | => /greeting/world           |
244 \&  '\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-'
245 \&  ...
246 .Ve
247 .PP
248 As you can see, Catalyst only deals with chains as whole paths and
249 builds one for each endpoint, which are the actions with \f(CW\*(C`:Chained\*(C'\fR but
250 without \f(CW\*(C`:CaptureArgs\*(C'\fR.
251 .PP
252 Let's assume this application gets a request at the path
253 \&\f(CW\*(C`/hello/23/world/12\*(C'\fR. What happens then? First, Catalyst will dispatch
254 to the \f(CW\*(C`hello\*(C'\fR action and pass the value \f(CW23\fR as an argument to it
255 after the context. It does so because we have previously used
256 \&\f(CW:CaptureArgs(1)\fR to declare that it has one path part after itself as
257 its argument. We told Catalyst that this is the beginning of the chain
258 by specifying \f(CW\*(C`:Chained('/')\*(C'\fR. Also note that instead of saying
259 \&\f(CW\*(C`:PathPart('hello')\*(C'\fR we could also just have said \f(CW\*(C`:PathPart\*(C'\fR, as it
260 defaults to the name of the action.
261 .PP
262 After \f(CW\*(C`hello\*(C'\fR has run, Catalyst goes on to dispatch to the \f(CW\*(C`world\*(C'\fR
263 action. This is the last action to be called: Catalyst knows this is an
264 endpoint because we did not specify a \f(CW\*(C`:CaptureArgs\*(C'\fR
265 attribute. Nevertheless we specify that this action expects an argument,
266 but at this point we're using \f(CW:Args(1)\fR to do that. We could also have
267 said \f(CW\*(C`:Args\*(C'\fR or left it out altogether, which would mean this action
268 would get all arguments that are there. This action's \f(CW\*(C`:Chained\*(C'\fR
269 attribute says \f(CW\*(C`hello\*(C'\fR and tells Catalyst that the \f(CW\*(C`hello\*(C'\fR action in
270 the current controller is its parent.
271 .PP
272 With this we have built a chain consisting of two public path parts.
273 \&\f(CW\*(C`hello\*(C'\fR captures one part of the path as its argument, and also
274 specifies the path root as its parent. So this part is
275 \&\f(CW\*(C`/hello/$arg\*(C'\fR. The next part is the endpoint \f(CW\*(C`world\*(C'\fR, expecting one
276 argument. It sums up to the path part \f(CW\*(C`world/$arg\*(C'\fR. This leads to a
277 complete chain of \f(CW\*(C`/hello/$arg/world/$arg\*(C'\fR which is matched against the
278 requested paths.
279 .PP
280 This example application would, if run and called by e.g.
281 \&\f(CW\*(C`/hello/23/world/12\*(C'\fR, set the stash value \f(CW\*(C`message\*(C'\fR to \*(L"Hello\*(R" and the
282 value \f(CW\*(C`arg_sum\*(C'\fR to \*(L"23\*(R". The \f(CW\*(C`world\*(C'\fR action would then append \*(L"World!\*(R"
283 to \f(CW\*(C`message\*(C'\fR and add \f(CW12\fR to the stash's \f(CW\*(C`arg_sum\*(C'\fR value.  For the
284 sake of simplicity no view is shown. Instead we just put the values of
285 the stash into our body. So the output would look like:
286 .PP
287 .Vb 2
288 \&  Hello World!
289 \&  35
290 .Ve
291 .PP
292 And our test server would have given us this debugging output for the
293 request:
294 .PP
295 .Vb 12
296 \&  ...
297 \&  [debug] "GET" request for "hello/23/world/12" from "127.0.0.1"
298 \&  [debug] Path is "/greeting/world"
299 \&  [debug] Arguments are "12"
300 \&  [info] Request took 0.164113s (6.093/s)
301 \&  .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-.
302 \&  | Action                                   | Time      |
303 \&  +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+
304 \&  | /greeting/hello                          | 0.000029s |
305 \&  | /greeting/world                          | 0.000024s |
306 \&  '\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-'
307 \&  ...
308 .Ve
309 .PP
310 What would be common uses of this dispatch technique? It gives the
311 possibility to split up logic that contains steps that each depend on
312 each other. An example would be, for example, a wiki path like
313 \&\f(CW\*(C`/wiki/FooBarPage/rev/23/view\*(C'\fR. This chain can be easily built with
314 these actions:
315 .PP
316 .Vb 5
317 \&  sub wiki : PathPart('wiki') Chained('/') CaptureArgs(1) {
318 \&      my ( $self, $c, $page_name ) = @_;
319 \&      #  load the page named $page_name and put the object
320 \&      #  into the stash
321 \&  }
322 .Ve
323 .PP
324 .Vb 5
325 \&  sub rev : PathPart('rev') Chained('wiki') CaptureArgs(1) {
326 \&      my ( $self, $c, $revision_id ) = @_;
327 \&      #  use the page object in the stash to get at its
328 \&      #  revision with number $revision_id
329 \&  }
330 .Ve
331 .PP
332 .Vb 8
333 \&  sub view : PathPart Chained('rev') Args(0) {
334 \&      my ( $self, $c ) = @_;
335 \&      #  display the revision in our stash. Another option
336 \&      #  would be to forward a compatible object to the action
337 \&      #  that displays the default wiki pages, unless we want
338 \&      #  a different interface here, for example restore
339 \&      #  functionality.
340 \&  }
341 .Ve
342 .PP
343 It would now be possible to add other endpoints, for example \f(CW\*(C`restore\*(C'\fR
344 to restore this specific revision as the current state.
345 .PP
346 You don't have to put all the chained actions in one controller. The
347 specification of the parent through \f(CW\*(C`:Chained\*(C'\fR also takes an absolute
348 action path as its argument. Just specify it with a leading \f(CW\*(C`/\*(C'\fR.
349 .PP
350 If you want, for example, to have actions for the public paths
351 \&\f(CW\*(C`/foo/12/edit\*(C'\fR and \f(CW\*(C`/foo/12\*(C'\fR, just specify two actions with
352 \&\f(CW\*(C`:PathPart('foo')\*(C'\fR and \f(CW\*(C`:Chained('/')\*(C'\fR. The handler for the former
353 path needs a \f(CW:CaptureArgs(1)\fR attribute and a endpoint with
354 \&\f(CW\*(C`:PathPart('edit')\*(C'\fR and \f(CW\*(C`:Chained('foo')\*(C'\fR. For the latter path give
355 the action just a \f(CW:Args(1)\fR to mark it as endpoint. This sums up to
356 this debugging output:
357 .PP
358 .Vb 10
359 \&  ...
360 \&  [debug] Loaded Path Part actions:
361 \&  .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-.
362 \&  | Path Spec             | Private                      |
363 \&  +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
364 \&  | /foo/*                | /controller/foo_view         |
365 \&  | /foo/*/edit           | /controller/foo_load (1)     |
366 \&  |                       | => /controller/edit          |
367 \&  '\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-'
368 \&  ...
369 .Ve
370 .PP
371 Here's a more detailed specification of the attributes belonging to
372 \&\f(CW\*(C`:Chained\*(C'\fR:
373 .Sh "Attributes"
374 .IX Subsection "Attributes"
375 .IP "PathPart" 8
376 .IX Item "PathPart"
377 Sets the name of this part of the chain. If it is specified without
378 arguments, it takes the name of the action as default. So basically
379 \&\f(CW\*(C`sub foo :PathPart\*(C'\fR and \f(CW\*(C`sub foo :PathPart('foo')\*(C'\fR are identical.
380 This can also contain slashes to bind to a deeper level. An action
381 with \f(CW\*(C`sub bar :PathPart('foo/bar') :Chained('/')\*(C'\fR would bind to
382 \&\f(CW\*(C`/foo/bar/...\*(C'\fR. If you don't specify \f(CW\*(C`:PathPart\*(C'\fR it has the same
383 effect as using \f(CW\*(C`:PathPart\*(C'\fR, it would default to the action name.
384 .IP "PathPrefix" 8
385 .IX Item "PathPrefix"
386 Sets PathPart to the path_prefix of the current controller.
387 .IP "Chained" 8
388 .IX Item "Chained"
389 Has to be specified for every child in the chain. Possible values are
390 absolute and relative private action paths or a single slash \f(CW\*(C`/\*(C'\fR to
391 tell Catalyst that this is the root of a chain. The attribute
392 \&\f(CW\*(C`:Chained\*(C'\fR without arguments also defaults to the \f(CW\*(C`/\*(C'\fR behavior.
393 Relative action paths may use \f(CW\*(C`../\*(C'\fR to refer to actions in parent
394 controllers.
395 .Sp
396 Because you can specify an absolute path to the parent action, it
397 doesn't matter to Catalyst where that parent is located. So, if your
398 design requests it, you can redispatch a chain through any controller or
399 namespace you want.
400 .Sp
401 Another interesting possibility gives \f(CW\*(C`:Chained('.')\*(C'\fR, which chains
402 itself to an action with the path of the current controller's namespace.
403 For example:
404 .Sp
405 .Vb 2
406 \&  #   in MyApp::Controller::Foo
407 \&  sub bar : Chained CaptureArgs(1) { ... }
408 .Ve
409 .Sp
410 .Vb 2
411 \&  #   in MyApp::Controller::Foo::Bar
412 \&  sub baz : Chained('.') Args(1) { ... }
413 .Ve
414 .Sp
415 This builds up a chain like \f(CW\*(C`/bar/*/baz/*\*(C'\fR. The specification of \f(CW\*(C`.\*(C'\fR
416 as the argument to Chained here chains the \f(CW\*(C`baz\*(C'\fR action to an action
417 with the path of the current controller namespace, namely
418 \&\f(CW\*(C`/foo/bar\*(C'\fR. That action chains directly to \f(CW\*(C`/\*(C'\fR, so the \f(CW\*(C`/bar/*/baz/*\*(C'\fR
419 chain comes out as the end product.
420 .IP "ChainedParent" 8
421 .IX Item "ChainedParent"
422 Chains an action to another action with the same name in the parent
423 controller. For Example:
424 .Sp
425 .Vb 2
426 \&  # in MyApp::Controller::Foo
427 \&  sub bar : Chained CaptureArgs(1) { ... }
428 .Ve
429 .Sp
430 .Vb 2
431 \&  # in MyApp::Controller::Foo::Moo
432 \&  sub bar : ChainedParent Args(1) { ... }
433 .Ve
434 .Sp
435 This builds a chain like \f(CW\*(C`/bar/*/bar/*\*(C'\fR.
436 .IP "CaptureArgs" 8
437 .IX Item "CaptureArgs"
438 Must be specified for every part of the chain that is not an
439 endpoint. With this attribute Catalyst knows how many of the following
440 parts of the path (separated by \f(CW\*(C`/\*(C'\fR) this action wants to capture as
441 its arguments. If it doesn't expect any, just specify
442 \&\f(CW:CaptureArgs(0)\fR.  The captures get passed to the action's \f(CW@_\fR right
443 after the context, but you can also find them as array references in
444 \&\f(CW\*(C`$c\->request\->captures\->[$level]\*(C'\fR. The \f(CW$level\fR is the
445 level of the action in the chain that captured the parts of the path.
446 .Sp
447 An action that is part of a chain (that is, one that has a \f(CW\*(C`:Chained\*(C'\fR
448 attribute) but has no \f(CW\*(C`:CaptureArgs\*(C'\fR attribute is treated by Catalyst
449 as a chain end.
450 .IP "Args" 8
451 .IX Item "Args"
452 By default, endpoints receive the rest of the arguments in the path. You
453 can tell Catalyst through \f(CW\*(C`:Args\*(C'\fR explicitly how many arguments your
454 endpoint expects, just like you can with \f(CW\*(C`:CaptureArgs\*(C'\fR. Note that this
455 also affects whether this chain is invoked on a request. A chain with an
456 endpoint specifying one argument will only match if exactly one argument
457 exists in the path.
458 .Sp
459 You can specify an exact number of arguments like \f(CW:Args(3)\fR, including
460 \&\f(CW0\fR. If you just say \f(CW\*(C`:Args\*(C'\fR without any arguments, it is the same as
461 leaving it out altogether: The chain is matched regardless of the number
462 of path parts after the endpoint.
463 .Sp
464 Just as with \f(CW\*(C`:CaptureArgs\*(C'\fR, the arguments get passed to the action in
465 \&\f(CW@_\fR after the context object. They can also be reached through
466 \&\f(CW\*(C`$c\->request\->arguments\*(C'\fR.
467 .Sh "Auto actions, dispatching and forwarding"
468 .IX Subsection "Auto actions, dispatching and forwarding"
469 Note that the list of \f(CW\*(C`auto\*(C'\fR actions called depends on the private path
470 of the endpoint of the chain, not on the chained actions way. The
471 \&\f(CW\*(C`auto\*(C'\fR actions will be run before the chain dispatching begins. In
472 every other aspect, \f(CW\*(C`auto\*(C'\fR actions behave as documented.
473 .PP
474 The \f(CW\*(C`forward\*(C'\fRing to other actions does just what you would expect. But if
475 you \f(CW\*(C`detach\*(C'\fR out of a chain, the rest of the chain will not get called
476 after the \f(CW\*(C`detach\*(C'\fR.
477 .SH "AUTHORS"
478 .IX Header "AUTHORS"
479 Catalyst Contributors, see Catalyst.pm
480 .SH "COPYRIGHT"
481 .IX Header "COPYRIGHT"
482 This library is free software. You can redistribute it and/or modify it under
483 the same terms as Perl itself.