line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Path::AttrRouter::Controller; |
2
|
8
|
|
|
8
|
|
49
|
use Mouse; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
43
|
|
3
|
8
|
|
|
8
|
|
3170
|
use Carp; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
720
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'Mouse::Object', 'Class::Data::Inheritable'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata( _attr_cache => [] ); |
8
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata( _method_cache => [] ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has namespace => ( |
11
|
|
|
|
|
|
|
is => 'rw', |
12
|
|
|
|
|
|
|
isa => 'Str', |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
8
|
|
|
8
|
|
38
|
no Mouse; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
37
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub import { |
18
|
8
|
|
|
8
|
|
18
|
my ($class, $flag) = @_; |
19
|
|
|
|
|
|
|
|
20
|
8
|
50
|
50
|
|
|
305
|
if (($flag || '') =~ /^\-extends/i) { |
21
|
0
|
|
|
|
|
0
|
my $caller = caller; |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
0
|
if ($caller->can('meta')) { |
24
|
0
|
|
|
|
|
0
|
$caller->meta->superclasses($caller->meta->superclasses, $class); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else { |
27
|
8
|
|
|
8
|
|
1414
|
no strict 'refs'; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
6364
|
|
28
|
0
|
|
|
|
|
0
|
push @{ $caller . '::ISA' }, $class; |
|
0
|
|
|
|
|
0
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub MODIFY_CODE_ATTRIBUTES { |
34
|
52
|
|
|
52
|
|
425632
|
my ($class, $code, @attrs) = @_; |
35
|
|
|
|
|
|
|
|
36
|
52
|
|
|
|
|
70
|
$class->_attr_cache([ @{ $class->_attr_cache } ]); |
|
52
|
|
|
|
|
213
|
|
37
|
52
|
|
|
|
|
1120
|
push @{ $class->_attr_cache }, [ $code, \@attrs ]; |
|
52
|
|
|
|
|
129
|
|
38
|
52
|
|
|
|
|
409
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _parse_Path_attr { |
42
|
29
|
|
|
29
|
|
75
|
my ($self, $name, $value) = @_; |
43
|
29
|
100
|
|
|
|
83
|
$value = '' unless defined $value; |
44
|
|
|
|
|
|
|
|
45
|
29
|
100
|
|
|
|
101
|
if ($value =~ m!^/!) { |
|
|
100
|
|
|
|
|
|
46
|
3
|
|
|
|
|
16
|
return Path => $value; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
elsif (length $value) { |
49
|
11
|
|
|
|
|
93
|
return Path => join '/', $self->namespace, $value; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else { |
52
|
15
|
|
|
|
|
132
|
return Path => $self->namespace; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _parse_Global_attr { |
57
|
2
|
|
|
2
|
|
3
|
my ($self, $name, $value) = @_; |
58
|
2
|
|
|
|
|
6
|
$self->_parse_Path_attr( $name, "/${name}" ); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _parse_Local_attr { |
62
|
2
|
|
|
2
|
|
5
|
my ($self, $name, $value) = @_; |
63
|
2
|
|
|
|
|
13
|
$self->_parse_Path_attr( $name, $name ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub _parse_Args_attr { |
67
|
22
|
|
|
22
|
|
43
|
my ($self, $name, $value) = @_; |
68
|
|
|
|
|
|
|
|
69
|
22
|
50
|
66
|
|
|
152
|
if (defined $value and $value !~ /^\d+$/) { |
70
|
0
|
|
|
|
|
0
|
carp "Args attribute is required numeric arguments: ignored Args('${value}')"; |
71
|
0
|
|
|
|
|
0
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
22
|
|
|
|
|
108
|
return Args => $value; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _parse_Private_attr { |
78
|
0
|
|
|
0
|
|
0
|
my ($self, $name, $value) = @_; |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
0
|
if ($value) { |
81
|
0
|
|
|
|
|
0
|
carp "Arguments to Private attribute are invalid. ignored: Private('${value}')"; |
82
|
0
|
|
|
|
|
0
|
return; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
0
|
return Private => 1; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub _parse_Regex_attr { |
89
|
4
|
|
|
4
|
|
11
|
my ($self, $name, $value) = @_; |
90
|
4
|
|
|
|
|
26
|
return Regex => $value; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub _parse_LocalRegex_attr { |
94
|
1
|
|
|
1
|
|
2
|
my ($self, $name, $value) = @_; |
95
|
|
|
|
|
|
|
|
96
|
1
|
50
|
|
|
|
5
|
unless ( $value =~ s/^\^// ) { $value = "(?:.*?)$value"; } |
|
0
|
|
|
|
|
0
|
|
97
|
|
|
|
|
|
|
|
98
|
1
|
|
|
|
|
4
|
my $prefix = $self->namespace; |
99
|
1
|
50
|
|
|
|
3
|
$prefix .= '/' if length( $prefix ); |
100
|
|
|
|
|
|
|
|
101
|
1
|
|
|
|
|
12
|
return ( 'Regex', "^${prefix}${value}" ); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub _parse_Chained_attr { |
105
|
18
|
|
|
18
|
|
58
|
my ($self, $name, $value) = @_; |
106
|
|
|
|
|
|
|
|
107
|
18
|
50
|
33
|
|
|
76
|
if (defined $value && length $value) { |
108
|
18
|
50
|
|
|
|
97
|
if ($value eq '.') { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
109
|
0
|
|
|
|
|
0
|
$value = '/' . $self->namespace; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
elsif (my ($rel, $rest) = $value =~ /^((?:\.{2}\/)+)(.*)$/) { |
112
|
4
|
|
|
|
|
22
|
my @parts = split '/', $self->namespace; |
113
|
4
|
|
|
|
|
12
|
my @levels = split '/', $rel; |
114
|
|
|
|
|
|
|
|
115
|
4
|
|
|
|
|
22
|
$value = '/' . join '/', @parts[0 .. $#parts - @levels], $rest; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
elsif ($value !~ m!^/!) { |
118
|
12
|
|
|
|
|
32
|
my $action_ns = $self->namespace; |
119
|
|
|
|
|
|
|
|
120
|
12
|
100
|
|
|
|
19
|
if ($action_ns) { |
121
|
11
|
|
|
|
|
27
|
$value = '/' . join '/', $action_ns, $value; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
else { |
124
|
1
|
|
|
|
|
3
|
$value = '/' . $value; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
else { |
129
|
0
|
|
|
|
|
0
|
$value = '/'; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
18
|
|
|
|
|
119
|
return Chained => $value; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub _parse_CaptureArgs_attr { |
136
|
4
|
|
|
4
|
|
7
|
my ($self, $name, $value) = @_; |
137
|
4
|
|
|
|
|
17
|
return CaptureArgs => $value; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub _parse_PathPart_attr { |
141
|
17
|
|
|
17
|
|
26
|
my ($self, $name, $value) = @_; |
142
|
17
|
|
|
|
|
70
|
return PathPart => $value; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
__END__ |