line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ark::Component; |
2
|
60
|
|
|
60
|
|
133709
|
use Mouse; |
|
60
|
|
|
|
|
125
|
|
|
60
|
|
|
|
|
628
|
|
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
|
60
|
|
|
60
|
|
27229
|
no Mouse; |
|
60
|
|
|
|
|
151
|
|
|
60
|
|
|
|
|
780
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub config { |
18
|
47
|
|
|
47
|
0
|
1113
|
my $class = shift; |
19
|
47
|
100
|
|
|
|
151
|
my $config = @_ > 1 ? {@_} : $_[0]; |
20
|
|
|
|
|
|
|
|
21
|
47
|
100
|
|
|
|
208
|
$class->__component_config({}) unless $class->__component_config; |
22
|
|
|
|
|
|
|
|
23
|
47
|
100
|
|
|
|
745
|
if ($config) { |
24
|
1
|
50
|
|
|
|
3
|
for my $key (keys %{ $config || {} }) { |
|
1
|
|
|
|
|
7
|
|
25
|
2
|
|
|
|
|
17
|
$class->__component_config->{ $key } = $config->{$key}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
47
|
|
|
|
|
159
|
$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
|
265
|
my $class = shift; |
36
|
23
|
50
|
|
|
|
70
|
$class = ref $class if ref $class; |
37
|
|
|
|
|
|
|
|
38
|
23
|
|
|
|
|
369
|
(my $name = $class) =~ s/$class_config_re/$1::/; |
39
|
23
|
|
|
|
|
358
|
$name; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub class_config { |
43
|
653
|
|
|
653
|
0
|
1777
|
my $self = shift; |
44
|
653
|
50
|
|
|
|
1353
|
my $config = @_ > 1 ? {@_} : $_[0]; |
45
|
653
|
|
|
|
|
1122
|
my $class = caller; |
46
|
|
|
|
|
|
|
|
47
|
653
|
50
|
|
|
|
2307
|
return unless $self->app; |
48
|
|
|
|
|
|
|
|
49
|
653
|
|
|
|
|
5756
|
(my $name = $class) =~ s/$class_config_re/$1::/; |
50
|
|
|
|
|
|
|
|
51
|
653
|
|
100
|
|
|
3857
|
my $classconfig = $self->app->config->{ $name } ||= {}; |
52
|
653
|
50
|
|
|
|
5471
|
if ($config) { |
53
|
0
|
0
|
|
|
|
0
|
for my $key (keys %{ $config || {} }) { |
|
0
|
|
|
|
|
0
|
|
54
|
0
|
|
|
|
|
0
|
$classconfig->{ $key } = $config->{$key}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
653
|
|
|
|
|
6299
|
$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; |