| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Catalyst::Action; |
|
2
|
|
|
|
|
|
|
|
|
3
|
48
|
|
|
48
|
|
644
|
use strict; |
|
|
48
|
|
|
|
|
588
|
|
|
|
48
|
|
|
|
|
1955
|
|
|
4
|
48
|
|
|
48
|
|
837
|
use base qw/Class::Accessor::Fast/; |
|
|
48
|
|
|
|
|
471
|
|
|
|
48
|
|
|
|
|
843
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Catalyst::Action - Catalyst Action |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
<form action="[%c.uri_for(c.action.reverse)%]"> |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
This class represents a Catalyst Action. You can access the object for the |
|
18
|
|
|
|
|
|
|
currently dispatched action via $c->action. See the L<Catalyst::Dispatcher> |
|
19
|
|
|
|
|
|
|
for more information on how actions are dispatched. Actions are defined in |
|
20
|
|
|
|
|
|
|
L<Catalyst::Controller> subclasses. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/class namespace reverse attributes name code/); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use overload ( |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
48892
|
|
|
48892
|
|
968612
|
q{""} => sub { shift->{reverse} }, |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
8459
|
|
|
8459
|
|
144252
|
'&{}' => sub { my $self = shift; sub { $self->execute(@_); }; }, |
|
|
8459
|
|
|
|
|
180315
|
|
|
|
8459
|
|
|
|
|
175106
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
48
|
|
|
|
|
3277
|
fallback => 1, |
|
36
|
|
|
|
|
|
|
|
|
37
|
48
|
|
|
48
|
|
930
|
); |
|
|
48
|
|
|
|
|
2556
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub dispatch { |
|
40
|
8460
|
|
|
8460
|
1
|
124580
|
my ( $self, $c ) = @_; |
|
41
|
8460
|
|
|
|
|
135237
|
local $c->namespace = $self->namespace; |
|
42
|
8460
|
|
|
|
|
149914
|
return $c->execute( $self->class, $self ); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub execute { |
|
46
|
8459
|
|
|
8459
|
1
|
127877
|
my $self = shift; |
|
47
|
8459
|
|
|
|
|
159170
|
$self->{code}->(@_); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub match { |
|
51
|
1253
|
|
|
1253
|
1
|
21401
|
my ( $self, $c ) = @_; |
|
52
|
1253
|
100
|
|
|
|
16593
|
return 1 unless exists $self->attributes->{Args}; |
|
53
|
686
|
|
|
|
|
17807
|
my $args = $self->attributes->{Args}[0]; |
|
54
|
686
|
100
|
66
|
|
|
23037
|
return 1 unless defined($args) && length($args); |
|
55
|
684
|
|
|
|
|
7646
|
return scalar( @{ $c->req->args } ) == $args; |
|
|
684
|
|
|
|
|
9017
|
|
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHODS |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 attributes |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The sub attributes that are set for this action, like Local, Path, Private |
|
67
|
|
|
|
|
|
|
and so on. This determines how the action is dispatched to. |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 class |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Returns the class name where this action is defined. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 code |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Returns a code reference to this action. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 dispatch( $c ) |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Dispatch this action against a context |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 execute( $controller, $c, @args ) |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Execute this action's coderef against a given controller with a given |
|
84
|
|
|
|
|
|
|
context and arguments |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 match( $c ) |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Check Args attribute, and makes sure number of args matches the setting. |
|
89
|
|
|
|
|
|
|
Always returns true if Args is omitted. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 namespace |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Returns the private namespace this action lives in. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 reverse |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Returns the private path for this action. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 name |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
returns the sub name of this action. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Matt S. Trout |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
|
110
|
|
|
|
|
|
|
the same terms as Perl itself. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |