| 1 | package BBS::Perm::Config; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 2 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 2 | ▶ | BEGIN { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.8
| |||||||||||||||||||||
| 8 | 2 | local $@; | |||||||||||||||||||
| 9 | 2 | eval { require YAML::Syck; }; | |||||||||||||||||||
| 10 | 2 | ▶ | if ($@) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 11 | 0 | require YAML; | |||||||||||||||||||
| 12 | 0 | *_LoadFile = *YAML::LoadFile; | |||||||||||||||||||
| 13 | 0 | *_DumpFile = *YAML::DumpFile; | |||||||||||||||||||
| 14 | } | ||||||||||||||||||||
| 15 | else { | ||||||||||||||||||||
| 16 | 2 | *_LoadFile = *YAML::Syck::LoadFile; | |||||||||||||||||||
| 17 | 2 | *_DumpFile = *YAML::Syck::DumpFile; | |||||||||||||||||||
| 18 | } | ||||||||||||||||||||
| 19 | } | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 3 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||
| 22 | 3 | my $class = shift; | |||||||||||||||||||
| 23 | 3 | my $self = {}; | |||||||||||||||||||
| 24 | 3 | ▶ | bless $self, ref $class || $class; | ||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 25 | 3 | my %opt = @_; | |||||||||||||||||||
| 26 | 3 | ▶ | if ( $opt{file} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 27 | 2 | $self->{file} = $opt{file}; | |||||||||||||||||||
| 28 | 2 | $self->load( $opt{file} ); | |||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | 3 | return $self; | |||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 3 | ▶ | sub load { | ||||||||||||||||||
|
Subroutine
load: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 34 | 3 | my $self = shift; | |||||||||||||||||||
| 35 | 3 | $self->{config} = _LoadFile(shift); | |||||||||||||||||||
| 36 | 3 | $self->_tidy; | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 3 | ▶ | sub _tidy { | ||||||||||||||||||
|
Subroutine
_tidy: called CC=4 SCAR=13.9
| |||||||||||||||||||||
| 40 | 3 | my $self = shift; | |||||||||||||||||||
| 41 | 3 | for my $site ( grep { $_ ne 'global' } keys %{ $self->{config} } ) { | |||||||||||||||||||
| 42 | 6 | for ( keys %{ $self->{config}{global} } ) { | |||||||||||||||||||
| 43 | $self->{config}{$site}{$_} = $self->{config}{global}{$_} | ||||||||||||||||||||
| 44 | 24 | ▶ | unless defined $self->{config}{$site}{$_}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 3 | ▶ | sub sites { | ||||||||||||||||||
|
Subroutine
sites: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 50 | 3 | my $self = shift; | |||||||||||||||||||
| 51 | 3 | return grep { $_ ne 'global' } keys %{ $self->{config} }; | |||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | 4 | ▶ | sub setting { | ||||||||||||||||||
|
Subroutine
setting: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 55 | 4 | my ( $self, $site ) = @_; | |||||||||||||||||||
| 56 | 4 | return $self->{config}{$site}; | |||||||||||||||||||
| 57 | } | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | 1 | ▶ | sub file { | ||||||||||||||||||
|
Subroutine
file: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 60 | 1 | return shift->{file}; | |||||||||||||||||||
| 61 | } | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | 2 | 1; | |||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | __END__ | ||||||||||||||||||||