File: Detach.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 (45 lines) | stat: -rw-r--r-- 981 bytes parent folder | download | duplicates (15)
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
35
36
37
38
39
40
41
42
43
44
45
package TestApp::Controller::Action::Detach;

use strict;
use base 'TestApp::Controller::Action';

sub one : Local {
    my ( $self, $c ) = @_;
    $c->detach('two');
    $c->forward('error');
}

sub two : Private {
    my ( $self, $c ) = @_;
    $c->forward('TestApp::View::Dump::Request');
}

sub error : Local {
    my ( $self, $c ) = @_;
    $c->res->output('error');
}

sub path : Local {
    my ( $self, $c ) = @_;
    $c->detach('/action/detach/two');
    $c->forward('error');
}

sub with_args : Local {
    my ( $self, $c, $orig ) = @_;
    $c->detach( 'args', [qq/new/] );
}

sub with_method_and_args : Local {
    my ( $self, $c, $orig ) = @_;
    $c->detach( qw/TestApp::Controller::Action::Detach args/, [qq/new/] );
}

sub args : Local {
    my ( $self, $c, $val ) = @_;
    die "Expected argument 'new', got '$val'" unless $val eq 'new';
    die "passed argument does not match args" unless $val eq $c->req->args->[0];
    $c->res->body( $c->req->args->[0] );
}

1;