| 1 | package Class::Usul::Config; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 19 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 19 | ▶ | use Class::Usul::Constants qw( CONFIG_EXTN DEFAULT_CONFHOME | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | DEFAULT_ENCODING DEFAULT_L10N_DOMAIN | ||||||||||||||||||||||||||||||||||||||||||
| 7 | 19 | FALSE LANG NUL PERL_EXTNS PHASE TRUE ); | |||||||||||||||||||||||||||||||||||||||||
| 8 | 19 | ▶ | use Class::Usul::File; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 19 | ▶ | use Class::Usul::Functions qw( app_prefix canonicalise class2appdir | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | home2appldir is_arrayref split_on__ | ||||||||||||||||||||||||||||||||||||||||||
| 11 | split_on_dash untaint_cmdline | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 19 | untaint_identifier untaint_path ); | |||||||||||||||||||||||||||||||||||||||||
| 13 | 19 | ▶ | use Class::Usul::Types qw( ArrayRef DataEncoding HashRef NonEmptySimpleStr | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 19 | NonZeroPositiveInt PositiveInt Str ); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 19 | ▶ | use Config; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 19 | ▶ | use English qw( -no_match_vars ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 19 | ▶ | use File::Basename qw( basename dirname ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 19 | ▶ | use File::DataClass::Types qw( Directory File Path ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 19 | ▶ | use File::Gettext::Constants qw( LOCALE_DIRS ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 19 | ▶ | use File::Spec::Functions qw( canonpath catdir catfile | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 19 | rel2abs rootdir tmpdir ); | |||||||||||||||||||||||||||||||||||||||||
| 22 | 19 | ▶ | use File::Which qw( which ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 19 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 19 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | # Attribute constructors | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 5 | ▶ | my $_build_l10n_attributes = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_l10n_attributes: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 5 | return { %{ $_[ 0 ]->_l10n_attributes }, domains => $_[ 0 ]->l10n_domains, }; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 19 | }; | |||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | # Public attributes | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 19 | has 'appclass' => is => 'ro', isa => NonEmptySimpleStr, required => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 19 | has 'appldir' => is => 'lazy', isa => Directory, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 19 | has 'binsdir' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | has 'cfgfiles' => is => 'lazy', isa => ArrayRef[NonEmptySimpleStr], | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | ▶ | builder => sub { [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_cfgfiles: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 19 | has 'ctlfile' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 19 | has 'ctrldir' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 19 | has 'datadir' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 19 | has 'encoding' => is => 'ro', isa => DataEncoding, coerce => TRUE, | |||||||||||||||||||||||||||||||||||||||||
| 48 | default => DEFAULT_ENCODING; | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 19 | has 'extension' => is => 'lazy', isa => NonEmptySimpleStr, | |||||||||||||||||||||||||||||||||||||||||
| 51 | default => CONFIG_EXTN; | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 19 | has 'home' => is => 'lazy', isa => Directory, coerce => TRUE, | |||||||||||||||||||||||||||||||||||||||||
| 54 | default => DEFAULT_CONFHOME; | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 19 | has 'locale' => is => 'ro', isa => NonEmptySimpleStr, default => LANG; | |||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 19 | has 'localedir' => is => 'lazy', isa => Directory, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | has 'locales' => is => 'ro', isa => ArrayRef[NonEmptySimpleStr], | ||||||||||||||||||||||||||||||||||||||||||
| 61 | 13 | ▶ | builder => sub { [ LANG ] }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_locales: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 19 | has 'logfile' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 19 | has 'logsdir' => is => 'lazy', isa => Directory, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 19 | has 'name' => is => 'lazy', isa => NonEmptySimpleStr; | |||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 19 | has 'no_thrash' => is => 'ro', isa => NonZeroPositiveInt, default => 3; | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 19 | has 'phase' => is => 'lazy', isa => PositiveInt; | |||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | has 'prefix' => is => 'lazy', isa => NonEmptySimpleStr, | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 2 | ▶ | coerce => sub { untaint_cmdline $_[ 0 ] }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 19 | has 'pathname' => is => 'lazy', isa => File, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 19 | has 'root' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 19 | has 'rundir' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 19 | has 'salt' => is => 'lazy', isa => NonEmptySimpleStr; | |||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 19 | has 'sessdir' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 19 | has 'sharedir' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 19 | has 'shell' => is => 'lazy', isa => File, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 19 | has 'suid' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 19 | has 'tempdir' => is => 'lazy', isa => Directory, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 19 | has 'vardir' => is => 'lazy', isa => Path, coerce => TRUE; | |||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 19 | has 'l10n_attributes' => is => 'lazy', isa => HashRef, | |||||||||||||||||||||||||||||||||||||||||
| 97 | builder => $_build_l10n_attributes, init_arg => undef; | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | has 'l10n_domains' => is => 'lazy', isa => ArrayRef[NonEmptySimpleStr], | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | builder => sub { [ DEFAULT_L10N_DOMAIN, $_[ 0 ]->name ] }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | has '_l10n_attributes' => is => 'lazy', isa => HashRef, | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 5 | ▶ | builder => sub { {} }, init_arg => 'l10n_attributes'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 23 | ▶ | has 'lock_attributes' => is => 'ro', isa => HashRef, builder => sub { {} }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_lock_attributes: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 23 | ▶ | has 'log_attributes' => is => 'ro', isa => HashRef, builder => sub { {} }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_log_attributes: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | # Private functions | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | my $_is_inflated = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my ($attr, $attr_name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | return exists $attr->{ $attr_name } && defined $attr->{ $attr_name } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | && $attr->{ $attr_name } !~ m{ \A __ }mx ? TRUE : FALSE; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $attr->{$attr_name} and defined $attr->{$attr_name} and not $attr->{$attr_name} =~ / \A __ /mx
exists $attr->{$attr_name} and defined $attr->{$attr_name}
MC/DC0%0/3
exists $attr->{$attr_name} and defined $attr->{$attr_name} and not $attr->{$attr_name} =~ / \A __ /mx
exists $attr->{$attr_name}
defined $attr->{$attr_name}
not $attr->{$attr_name} =~ / \A __ /mx
Truth table0%0/4
A and B and not(C)
A= exists $attr->{$attr_name}B= defined $attr->{$attr_name}C= not $attr->{$attr_name} =~ / \A __ /mx
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 19 | }; | |||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 6 | ▶ | my $_unpack = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 6 | ▶ | my ($self, $attr) = @_; $attr //= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$attr //= {}
MC/DC0%0/1
$attr //= {}
$attr
Truth table50%1/2
A
A= $attr
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 6 | ▶ | blessed $self and return ($self, $self->{appclass}, $self->{home}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | return ($self, $attr->{appclass}, $attr->{home}); | |||||||||||||||||||||||||||||||||||||||||
| 123 | 19 | }; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | # Construction | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 24 | ▶ | around 'BUILDARGS' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=24.1
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 24 | my ($orig, $self, @args) = @_; my $attr = $orig->( $self, @args ); | |||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 24 | ▶ | my $paths; if ($paths = $attr->{cfgfiles} and $paths->[ 0 ]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$paths = $attr->{"cfgfiles"} and $paths->[0]
MC/DC0%0/2
$paths = $attr->{"cfgfiles"} and $paths->[0]
$paths = $attr->{"cfgfiles"}
$paths->[0]
Truth table66%2/3
A and B
A= $paths = $attr->{"cfgfiles"}B= $paths->[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | my $loaded = Class::Usul::File->data_load( paths => $paths ) || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
'Class::Usul::File'->data_load('paths', $paths) || {}
MC/DC0%0/1
'Class::Usul::File'->data_load('paths', $paths) || {}
'Class::Usul::File'->data_load('paths', $paths)
Truth table0%0/2
A
A= 'Class::Usul::File'->data_load('paths', $paths)
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $attr = { %{ $loaded }, %{ $attr } }; # Yes this way round. Leave it alone | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 24 | for my $name (keys %{ $attr }) { | |||||||||||||||||||||||||||||||||||||||||
| 136 | defined $attr->{ $name } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | and $attr->{ $name } =~ m{ \A __([^\(]+?)__ \z }mx | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 137 | ▶ | and $attr->{ $name } = $self->inflate_symbol( $attr, $1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $attr->{$name} and $attr->{$name} =~ / \A __([^\(]+?)__ \z /mx
MC/DC0%0/2
defined $attr->{$name} and $attr->{$name} =~ / \A __([^\(]+?)__ \z /mx
defined $attr->{$name}
$attr->{$name} =~ / \A __([^\(]+?)__ \z /mx
Truth table33%1/3
A and B
A= defined $attr->{$name}B= $attr->{$name} =~ / \A __([^\(]+?)__ \z /mx
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 24 | $self->inflate_paths( $attr ); | |||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 24 | return $attr; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 19 | }; | |||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 6 | ▶ | sub _build_appldir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_appldir: called CC=9 SCAR=30.1
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 6 | my ($self, $appclass, $home) = $_unpack->( @_ ); my $dir; | |||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 6 | ▶ | $dir = home2appldir $home | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$dir = &home2appldir($home) and $dir = rel2abs(&untaint_path($dir)) and -d catdir($dir, "lib")
$dir = &home2appldir($home) and $dir = rel2abs(&untaint_path($dir))
MC/DC0%0/3
$dir = &home2appldir($home) and $dir = rel2abs(&untaint_path($dir)) and -d catdir($dir, "lib")
$dir = &home2appldir($home)
$dir = rel2abs(&untaint_path($dir))
-d catdir($dir, "lib")
Truth table25%1/4
A and B and C
A= $dir = &home2appldir($home)B= $dir = rel2abs(&untaint_path($dir))C= -d catdir($dir, "lib")
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | and $dir = rel2abs( untaint_path $dir ) | ||||||||||||||||||||||||||||||||||||||||||
| 151 | and -d catdir( $dir, 'lib' ) and return $dir; | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 6 | ▶ | $dir = catdir( NUL, 'var', class2appdir $appclass ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$dir = catdir("", "var", &class2appdir($appclass)) and $dir = rel2abs(&untaint_path($dir)) and -d $dir
$dir = catdir("", "var", &class2appdir($appclass)) and $dir = rel2abs(&untaint_path($dir))
MC/DC0%0/3
$dir = catdir("", "var", &class2appdir($appclass)) and $dir = rel2abs(&untaint_path($dir)) and -d $dir
$dir = catdir("", "var", &class2appdir($appclass))
$dir = rel2abs(&untaint_path($dir))
-d $dir
Truth table25%1/4
A and B and C
A= $dir = catdir("", "var", &class2appdir($appclass))B= $dir = rel2abs(&untaint_path($dir))C= -d $dir
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | and $dir = rel2abs( untaint_path $dir ) | ||||||||||||||||||||||||||||||||||||||||||
| 155 | and -d $dir and return $dir; | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 6 | ▶ | $dir = rel2abs( untaint_path $home ) and -d $dir and return $dir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$dir = rel2abs(&untaint_path($home)) and -d $dir
MC/DC0%0/2
$dir = rel2abs(&untaint_path($home)) and -d $dir
$dir = rel2abs(&untaint_path($home))
-d $dir
Truth table33%1/3
A and B
A= $dir = rel2abs(&untaint_path($home))B= -d $dir
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | return rel2abs( untaint_path rootdir ); | |||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | ▶ | sub _build_binsdir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_binsdir: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'appldir', 'bin' ); | |||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | ▶ | return -d $dir ? $dir : untaint_path $Config{installsitescript}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | ▶ | sub _build_ctlfile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_ctlfile: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | my $name = $_[ 0 ]->inflate_symbol( $_[ 1 ], 'name' ); | |||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | my $extension = $_[ 0 ]->inflate_symbol( $_[ 1 ], 'extension' ); | |||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 2 | return $_[ 0 ]->inflate_path( $_[ 1 ], 'ctrldir', $name.$extension ); | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 2 | ▶ | sub _build_ctrldir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_ctrldir: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'vardir', 'etc' ); | |||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 2 | ▶ | -d $dir and return $dir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'appldir', 'etc' ); | |||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 2 | ▶ | return -d $dir ? $dir : [ NUL, qw( usr local etc ) ]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | 2 | ▶ | sub _build_datadir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_datadir: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 2 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'vardir', 'data' ); | |||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 2 | ▶ | return -d $dir ? $dir : $_[ 0 ]->inflate_path( $_[ 1 ], 'tempdir' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 5 | ▶ | sub _build_localedir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_localedir: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 5 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'vardir', 'locale' ); | |||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 5 | ▶ | -d $dir and return $dir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 5 | ▶ | for (map { catdir( @{ $_ } ) } @{ LOCALE_DIRS() } ) { -d $_ and return $_ } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | return $_[ 0 ]->inflate_path( $_[ 1 ], 'tempdir' ); | |||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 7 | ▶ | sub _build_logfile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_logfile: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 7 | my $name = $_[ 0 ]->inflate_symbol( $_[ 1 ], 'name' ); | |||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 7 | return $_[ 0 ]->inflate_path( $_[ 1 ], 'logsdir', "${name}.log" ); | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | ▶ | sub _build_logsdir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_logsdir: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'vardir', 'logs' ); | |||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 1 | ▶ | return -d $dir ? $dir : $_[ 0 ]->inflate_path( $_[ 1 ], 'tempdir' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 8 | ▶ | sub _build_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_name: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 8 | my $name = basename | |||||||||||||||||||||||||||||||||||||||||
| 215 | ( $_[ 0 ]->inflate_path( $_[ 1 ], 'pathname' ), PERL_EXTNS ); | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 8 | ▶ | return (split_on__ $name, 1) || (split_on_dash $name, 1) || $name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
&split_on__($name, 1) || &split_on_dash($name, 1) || $name
&split_on__($name, 1) or &split_on_dash($name, 1)
MC/DC0%0/3
&split_on__($name, 1) || &split_on_dash($name, 1) || $name
&split_on__($name, 1)
&split_on_dash($name, 1)
$name
Truth table25%1/4
A or B || C
A= &split_on__($name, 1)B= &split_on_dash($name, 1)C= $name
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 8 | ▶ | sub _build_pathname { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_pathname: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 8 | ▶ | my $name = ('-' eq substr $PROGRAM_NAME, 0, 1) ? $EXECUTABLE_NAME | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | : $PROGRAM_NAME; | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 8 | return rel2abs( (split m{ [ ][\-][ ] }mx, $name)[ 0 ] ); | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | ▶ | sub _build_phase { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_phase: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 1 | my $verdir = basename( $_[ 0 ]->inflate_path( $_[ 1 ], 'appldir' ) ); | |||||||||||||||||||||||||||||||||||||||||
| 229 | 1 | my ($phase) = $verdir =~ m{ \A v \d+ \. \d+ p (\d+) \z }msx; | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | ▶ | return defined $phase ? $phase : PHASE; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 2 | ▶ | sub _build_prefix { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_prefix: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 2 | my $appclass = $_[ 0 ]->inflate_symbol( $_[ 1 ], 'appclass' ); | |||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 2 | return (split m{ :: }mx, lc $appclass)[ -1 ]; | |||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 1 | ▶ | sub _build_root { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_root: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | 1 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'vardir', 'root' ); | |||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 1 | ▶ | return -d $dir ? $dir : $_[ 0 ]->inflate_path( $_[ 1 ], 'tempdir' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | ▶ | sub _build_rundir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_rundir: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'vardir', 'run' ); | |||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 1 | ▶ | return -d $dir ? $dir : $_[ 0 ]->inflate_path( $_[ 1 ], 'tempdir' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 1 | ▶ | sub _build_sessdir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_sessdir: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 1 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'vardir', 'session' ); | |||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 1 | ▶ | return -d $dir ? $dir : $_[ 0 ]->inflate_path( $_[ 1 ], 'tempdir' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 1 | ▶ | sub _build_sharedir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_sharedir: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'vardir', 'share' ); | |||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 1 | ▶ | return -d $dir ? $dir : $_[ 0 ]->inflate_path( $_[ 1 ], 'tempdir' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 1 | ▶ | sub _build_shell { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_shell: called CC=7 SCAR=27.6
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | ▶ | my $file = $ENV{SHELL}; $file and -e $file and return $file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$file and -e $file
MC/DC0%0/2
$file and -e $file
$file
-e $file
Truth table33%1/3
A and B
A= $fileB= -e $file
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 1 | ▶ | $file = catfile( NUL, 'bin', 'ksh' ); -e $file and return $file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | ▶ | $file = catfile( NUL, 'bin', 'bash' ); -e $file and return $file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | $file = which ( 'sh' ); $file and -e $file and return $file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$file and -e $file
MC/DC0%0/2
$file and -e $file
$file
-e $file
Truth table0%0/3
A and B
A= $fileB= -e $file
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | return catfile( NUL, 'bin', 'sh' ); | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 2 | ▶ | sub _build_salt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_salt: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 2 | return untaint_cmdline $_[ 0 ]->inflate_symbol( $_[ 1 ], 'prefix' ); | |||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | ▶ | sub _build_suid { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_suid: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 1 | my $prefix = $_[ 0 ]->inflate_symbol( $_[ 1 ], 'prefix' ); | |||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 1 | return $_[ 0 ]->inflate_path( $_[ 1 ], 'binsdir', "${prefix}-admin" ); | |||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | sub _build_tempdir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_tempdir: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'vardir', 'tmp' ); | |||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | return -d $dir ? $dir : untaint_path tmpdir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 6 | ▶ | sub _build_vardir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_vardir: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 6 | my $dir = $_[ 0 ]->inflate_path( $_[ 1 ], 'appldir', 'var' ); | |||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 6 | ▶ | return -e $dir ? $dir : $_[ 0 ]->inflate_path( $_[ 1 ], 'appldir' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | # Public methods | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 58 | ▶ | sub inflate_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inflate_path: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 58 | return canonicalise $_[ 0 ]->inflate_symbol( $_[ 1 ], $_[ 2 ] ), $_[ 3 ]; | |||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 25 | ▶ | sub inflate_paths { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inflate_paths: called CC=5 SCAR=16.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | 25 | ▶ | my ($self, $attr) = @_; defined $attr or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 24 | for my $name (keys %{ $attr }) { | |||||||||||||||||||||||||||||||||||||||||
| 303 | defined $attr->{ $name } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | and $attr->{ $name } =~ m{ \A __(.+?)\((.+?)\)__ \z }mx | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 137 | ▶ | and $attr->{ $name } = $self->inflate_path( $attr, $1, $2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $attr->{$name} and $attr->{$name} =~ / \A __(.+?)\((.+?)\)__ \z /mx
MC/DC0%0/2
defined $attr->{$name} and $attr->{$name} =~ / \A __(.+?)\((.+?)\)__ \z /mx
defined $attr->{$name}
$attr->{$name} =~ / \A __(.+?)\((.+?)\)__ \z /mx
Truth table33%1/3
A and B
A= defined $attr->{$name}B= $attr->{$name} =~ / \A __(.+?)\((.+?)\)__ \z /mx
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 24 | return; | |||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 76 | ▶ | sub inflate_symbol { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inflate_symbol: called CC=5 SCAR=17.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 76 | ▶ | my ($self, $attr, $symbol) = @_; $attr //= {}; defined $symbol or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$attr //= {}
MC/DC0%0/1
$attr //= {}
$attr
Truth table50%1/2
A
A= $attr
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | 74 | my $attr_name = lc $symbol; my $method = "_build_${attr_name}"; | |||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | return blessed $self ? $self->$attr_name() | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 74 | ▶ | : $_is_inflated->( $attr, $attr_name ) ? $attr->{ $attr_name } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | : $self->$method( $attr ); | ||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 19 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | __END__ | ||||||||||||||||||||||||||||||||||||||||||