line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
553
|
use strict ; |
|
1
|
|
|
|
|
24
|
|
|
1
|
|
|
|
|
44
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This file uses the "Perlish" coding style |
4
|
|
|
|
|
|
|
# please read http://perl.4pro.net/perlish_coding_style.html |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
; package CGI::Builder::Conf |
7
|
|
|
|
|
|
|
; use Carp |
8
|
1
|
|
|
1
|
|
5
|
; $Carp::Internal{+__PACKAGE__}++ |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
103
|
|
9
|
|
|
|
|
|
|
; $Carp::Internal{__PACKAGE__.'::_'}++ |
10
|
|
|
|
|
|
|
; use IO::Util |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
; use Class::constr |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
14
|
1
|
|
|
|
|
9
|
{ default => \&CGI::Builder::Conf::_::default |
15
|
|
|
|
|
|
|
, init => \&CGI::Builder::_::init |
16
|
|
|
|
|
|
|
, no_strict => 1 |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
153
|
; use Class::groups |
|
1
|
|
|
|
|
2
|
|
20
|
1
|
|
|
|
|
17
|
( { name => 'conf_mml_options' |
21
|
|
|
|
|
|
|
, default => { optional => 1 |
22
|
|
|
|
|
|
|
, filter => { qr/.+/ => 'TRIM_BLANKS' } |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
) |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
75
|
; *conf_option = \&conf_mml_options |
|
1
|
|
|
|
|
2
|
|
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
6
|
; use Object::props 'conf_file' |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
74
|
; sub CGI::Builder::Conf::_::default |
|
1
|
|
|
|
|
1
|
|
32
|
2
|
|
|
2
|
|
453
|
{ my ($s, %args) = @_ |
33
|
2
|
50
|
33
|
|
|
13
|
; my $file = $args{conf_file} || $s->conf_file or return {} |
34
|
2
|
|
33
|
|
|
17
|
; my $opt = $args{conf_mml_options} || $s->conf_mml_options |
35
|
2
|
|
|
|
|
50
|
; my (%defaults, $sub) |
36
|
|
|
|
|
|
|
; $sub = sub |
37
|
3
|
|
|
3
|
|
1278
|
{ my ($res, $h) = @_ |
38
|
3
|
|
|
|
|
11
|
; foreach my $k ( keys %$h ) |
39
|
6
|
50
|
|
|
|
25
|
{ $$res{$k} = ref $$h{$k} eq 'HASH' |
40
|
|
|
|
|
|
|
? $sub->($$res{$k}, $$h{$k}) |
41
|
|
|
|
|
|
|
: $$h{$k} |
42
|
|
|
|
|
|
|
} |
43
|
3
|
|
|
|
|
11
|
; $res |
44
|
|
|
|
|
|
|
} |
45
|
2
|
100
|
|
|
|
24
|
; foreach my $conf ( ref $file eq 'ARRAY' ? @$file : $file ) |
|
2
|
|
|
|
|
20
|
|
46
|
3
|
|
|
|
|
12
|
{ $sub->( \%defaults, IO::Util::load_mml( $conf, $opt ) ) |
47
|
|
|
|
|
|
|
} |
48
|
2
|
|
|
|
|
8
|
; \%defaults |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
; 1 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |