line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Path::AttrRouter::Action; |
2
|
8
|
|
|
8
|
|
40
|
use Mouse; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
43
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has [qw/namespace reverse name/] => ( |
5
|
|
|
|
|
|
|
is => 'ro', |
6
|
|
|
|
|
|
|
isa => 'Str', |
7
|
|
|
|
|
|
|
required => 1, |
8
|
|
|
|
|
|
|
); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has attributes => ( |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
isa => 'HashRef', |
13
|
|
|
|
|
|
|
required => 1, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has controller => ( |
17
|
|
|
|
|
|
|
is => 'rw', |
18
|
|
|
|
|
|
|
isa => 'Object | Str', |
19
|
|
|
|
|
|
|
required => 1, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has num_args => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => 'Maybe[Int]', |
25
|
|
|
|
|
|
|
lazy => 1, |
26
|
|
|
|
|
|
|
default => sub { |
27
|
|
|
|
|
|
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return 0 unless exists $self->attributes->{Args}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
if (defined $self->attributes->{Args}[0]) { |
32
|
|
|
|
|
|
|
return $self->attributes->{Args}[0]; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
|
|
|
|
|
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has chain => ( |
41
|
|
|
|
|
|
|
is => 'rw', |
42
|
|
|
|
|
|
|
isa => 'ArrayRef', |
43
|
|
|
|
|
|
|
default => sub { [] }, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
8
|
|
|
8
|
|
3273
|
no Mouse; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
36
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub dispatch { |
49
|
6
|
|
|
6
|
0
|
8
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
6
|
|
|
|
|
12
|
my $class = $self->controller; |
52
|
6
|
|
|
|
|
10
|
my $method = $self->name; |
53
|
|
|
|
|
|
|
|
54
|
6
|
|
|
|
|
30
|
$class->$method(@_); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub match { |
58
|
109
|
|
|
109
|
0
|
143
|
my ($self, $condition) = @_; |
59
|
|
|
|
|
|
|
|
60
|
109
|
100
|
|
|
|
285
|
return 0 unless $self->match_args($condition->{args}); |
61
|
56
|
|
|
|
|
281
|
return 1; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub match_args { |
65
|
109
|
|
|
109
|
0
|
120
|
my ($self, $args) = @_; |
66
|
|
|
|
|
|
|
|
67
|
109
|
|
|
|
|
272
|
my $num_args = $self->num_args; |
68
|
109
|
100
|
66
|
|
|
465
|
return 1 unless defined($num_args) && length($num_args); |
69
|
105
|
|
|
|
|
527
|
return scalar(@$args) == $num_args; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub from_chain { |
73
|
14
|
|
|
14
|
0
|
18
|
my ($class, $chains) = @_; |
74
|
14
|
|
|
|
|
19
|
my $final = $chains->[-1]; |
75
|
|
|
|
|
|
|
|
76
|
14
|
|
|
|
|
502
|
$class->new({ %$final, chain => $chains }); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|