| 1 | 1 | ▶ | use strict ; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 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 | ▶ | ; $Carp::Internal{+__PACKAGE__}++ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ; $Carp::Internal{__PACKAGE__.'::_'}++ | |||||||||||||||||||||||||||
| 10 | ; use IO::Util | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | ; use Class::constr | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | { default => \&CGI::Builder::Conf::_::default | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | , init => \&CGI::Builder::_::init | ||||||||||||||||||||||||||||
| 16 | , no_strict => 1 | ||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | ; use Class::groups | |||||||||||||||||||||||||||
| 20 | 1 | ▶ | ( { name => 'conf_mml_options' | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | , default => { optional => 1 | ||||||||||||||||||||||||||||
| 22 | , filter => { qr/.+/ => 'TRIM_BLANKS' } | ||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | ) | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 1 | ; *conf_option = \&conf_mml_options | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 1 | ▶ | ; use Object::props 'conf_file' | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | ; sub CGI::Builder::Conf::_::default | |||||||||||||||||||||||||||
| 32 | 2 | ▶ | { my ($s, %args) = @_ | ||||||||||||||||||||||||||
|
Subroutine
default: called CC=6 SCAR=18.8
| |||||||||||||||||||||||||||||
| 33 | 2 | ▶ | ; my $file = $args{conf_file} || $s->conf_file or return {} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{'conf_file'} || $s->conf_file
MC/DC0%0/2
$args{'conf_file'} || $s->conf_file
$args{'conf_file'}
$s->conf_file
Truth table33%1/3
A || B
A= $args{'conf_file'}B= $s->conf_file
| |||||||||||||||||||||||||||||
| 34 | 2 | ▶ | ; my $opt = $args{conf_mml_options} || $s->conf_mml_options | ||||||||||||||||||||||||||
|
Condition33%1/3
$args{'conf_mml_options'} || $s->conf_mml_options
MC/DC0%0/2
$args{'conf_mml_options'} || $s->conf_mml_options
$args{'conf_mml_options'}
$s->conf_mml_options
Truth table33%1/3
A || B
A= $args{'conf_mml_options'}B= $s->conf_mml_options
| |||||||||||||||||||||||||||||
| 35 | 2 | ; my (%defaults, $sub) | |||||||||||||||||||||||||||
| 36 | ; $sub = sub | ||||||||||||||||||||||||||||
| 37 | 3 | ▶ | { my ($res, $h) = @_ | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||
| 38 | 3 | ; foreach my $k ( keys %$h ) | |||||||||||||||||||||||||||
| 39 | { $$res{$k} = ref $$h{$k} eq 'HASH' | ||||||||||||||||||||||||||||
| 40 | ? $sub->($$res{$k}, $$h{$k}) | ||||||||||||||||||||||||||||
| 41 | 6 | ▶ | : $$h{$k} | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | 3 | ; $res | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | 2 | ▶ | ; foreach my $conf ( ref $file eq 'ARRAY' ? @$file : $file ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 3 | { $sub->( \%defaults, IO::Util::load_mml( $conf, $opt ) ) | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | 2 | ; \%defaults | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 1 | ; 1 | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||||||||||