File: PassedArgs.pm

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (34 lines) | stat: -rw-r--r-- 895 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package TestApp::Controller::Action::Chained::PassedArgs;
use warnings;
use strict;

use base qw( Catalyst::Controller );

#
#   This controller builds a simple chain of three actions that
#   will output the arguments they got passed to @_ after the
#   context object. We do this to test if that passing works
#   as it should.
#

sub first  : PathPart('chained/passedargs/a') Chained('/') CaptureArgs(1) {
    my ( $self, $c, $arg ) = @_;
    $c->stash->{ passed_args } = [ $arg ];
}

sub second : PathPart('b') Chained('first') CaptureArgs(1) {
    my ( $self, $c, $arg ) = @_;
    push @{ $c->stash->{ passed_args } }, $arg;
}

sub third  : PathPart('c') Chained('second') Args(1) {
    my ( $self, $c, $arg ) = @_;
    push @{ $c->stash->{ passed_args } }, $arg;
}

sub end : Private {
    my ( $self, $c ) = @_;
    $c->response->body( join '; ', @{ $c->stash->{ passed_args } } );
}

1;