line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ark::Component; |
2
|
61
|
|
|
61
|
|
26927
|
use Mouse; |
|
61
|
|
|
|
|
138
|
|
|
61
|
|
|
|
|
334
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
extends 'Class::Data::Inheritable'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata(qw/__component_config/); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has app => ( |
9
|
|
|
|
|
|
|
is => 'rw', |
10
|
|
|
|
|
|
|
isa => 'Ark::Core', |
11
|
|
|
|
|
|
|
weak_ref => 1, |
12
|
|
|
|
|
|
|
handles => ['log', 'context', 'ensure_class_loaded', 'path_to'], |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
61
|
|
|
61
|
|
25424
|
no Mouse; |
|
61
|
|
|
|
|
119
|
|
|
61
|
|
|
|
|
278
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub config { |
18
|
47
|
|
|
47
|
0
|
1185
|
my $class = shift; |
19
|
47
|
100
|
|
|
|
126
|
my $config = @_ > 1 ? {@_} : $_[0]; |
20
|
|
|
|
|
|
|
|
21
|
47
|
100
|
|
|
|
147
|
$class->__component_config({}) unless $class->__component_config; |
22
|
|
|
|
|
|
|
|
23
|
47
|
100
|
|
|
|
699
|
if ($config) { |
24
|
1
|
50
|
|
|
|
3
|
for my $key (keys %{ $config || {} }) { |
|
1
|
|
|
|
|
6
|
|
25
|
2
|
|
|
|
|
12
|
$class->__component_config->{ $key } = $config->{$key}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
47
|
|
|
|
|
112
|
$class->__component_config; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $class_config_re = qr/^.*?::(Controller|ActionClass|View|Model|Plugin)::/; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub component_name { |
35
|
23
|
|
|
23
|
0
|
212
|
my $class = shift; |
36
|
23
|
50
|
|
|
|
59
|
$class = ref $class if ref $class; |
37
|
|
|
|
|
|
|
|
38
|
23
|
|
|
|
|
307
|
(my $name = $class) =~ s/$class_config_re/$1::/; |
39
|
23
|
|
|
|
|
162
|
$name; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub class_config { |
43
|
792
|
|
|
792
|
0
|
860
|
my $self = shift; |
44
|
792
|
50
|
|
|
|
1182
|
my $config = @_ > 1 ? {@_} : $_[0]; |
45
|
792
|
|
|
|
|
1088
|
my $class = caller; |
46
|
|
|
|
|
|
|
|
47
|
792
|
50
|
|
|
|
1592
|
return unless $self->app; |
48
|
|
|
|
|
|
|
|
49
|
792
|
|
|
|
|
5526
|
(my $name = $class) =~ s/$class_config_re/$1::/; |
50
|
|
|
|
|
|
|
|
51
|
792
|
|
100
|
|
|
2215
|
my $classconfig = $self->app->config->{ $name } ||= {}; |
52
|
792
|
50
|
|
|
|
5132
|
if ($config) { |
53
|
0
|
0
|
|
|
|
0
|
for my $key (keys %{ $config || {} }) { |
|
0
|
|
|
|
|
0
|
|
54
|
0
|
|
|
|
|
0
|
$classconfig->{ $key } = $config->{$key}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
792
|
|
|
|
|
4673
|
$classconfig; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub class_stash { |
62
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
63
|
0
|
|
|
|
|
|
my $class = caller; |
64
|
0
|
0
|
|
|
|
|
return unless $self->app; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
0
|
|
|
|
$self->app->class_stash->{ $class } ||= {}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |