line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=head1 NAME |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
Catalyst::ActionContainer - Catalyst Action Container |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 SYNOPSIS |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
See L<Catalyst>. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
This is a container for actions. The dispatcher sets up a tree of these |
13
|
|
|
|
|
|
|
to represent the various dispatch points in your application. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Moose; |
18
|
154
|
|
|
154
|
|
6068
|
with 'MooseX::Emulate::Class::Accessor::Fast'; |
|
154
|
|
|
|
|
439
|
|
|
154
|
|
|
|
|
1352
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has part => (is => 'rw', required => 1); |
21
|
|
|
|
|
|
|
has actions => (is => 'rw', required => 1, lazy => 1, default => sub { {} }); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
around BUILDARGS => sub { |
24
|
|
|
|
|
|
|
my ($next, $self, @args) = @_; |
25
|
|
|
|
|
|
|
unshift @args, 'part' if scalar @args == 1 && !ref $args[0]; |
26
|
|
|
|
|
|
|
return $self->$next(@args); |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
no Moose; |
30
|
154
|
|
|
154
|
|
1072299
|
|
|
154
|
|
|
|
|
482
|
|
|
154
|
|
|
|
|
968
|
|
31
|
|
|
|
|
|
|
use overload ( |
32
|
|
|
|
|
|
|
# Stringify to path part for tree search |
33
|
|
|
|
|
|
|
q{""} => sub { shift->part }, |
34
|
33
|
|
|
33
|
|
1023
|
); |
35
|
154
|
|
|
154
|
|
40353
|
|
|
154
|
|
|
|
|
414
|
|
|
154
|
|
|
|
|
1756
|
|
36
|
|
|
|
|
|
|
my ( $self, $name ) = @_; |
37
|
|
|
|
|
|
|
return $self->actions->{$name} if defined $self->actions->{$name}; |
38
|
6175
|
|
|
6175
|
1
|
13072
|
return; |
39
|
6175
|
100
|
|
|
|
172417
|
} |
40
|
4646
|
|
|
|
|
15738
|
|
41
|
|
|
|
|
|
|
my ( $self, $action, $name ) = @_; |
42
|
|
|
|
|
|
|
$name ||= $action->name; |
43
|
|
|
|
|
|
|
$self->actions->{$name} = $action; |
44
|
69172
|
|
|
69172
|
1
|
136634
|
} |
45
|
69172
|
|
33
|
|
|
1874677
|
|
46
|
69172
|
|
|
|
|
1940787
|
__PACKAGE__->meta->make_immutable; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 METHODS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 new(\%data | $part) |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Can be called with { part => $part, actions => \%actions } for full |
56
|
|
|
|
|
|
|
construction or with just a part, which will result in an empty actions |
57
|
|
|
|
|
|
|
hashref to be populated via add_action later |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 get_action($name) |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Returns an action from this container based on the action name, or undef |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 add_action($action, [ $name ]) |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Adds an action, optionally providing a name to override $action->name |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 actions |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Accessor to the actions hashref, containing all actions in this container. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 part |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Accessor to the path part this container resolves to. Also what the container |
74
|
|
|
|
|
|
|
stringifies to. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 meta |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Provided by Moose |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHORS |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Catalyst Contributors, see Catalyst.pm |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 COPYRIGHT |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This library is free software. You can redistribute it and/or modify it under |
87
|
|
|
|
|
|
|
the same terms as Perl itself. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |