line |
true |
false |
branch |
19
|
0 |
6 |
unless defined $subs |
22
|
5 |
1 |
if ($xtra ne 'no_new') |
24
|
4 |
1 |
if ($xtra ne 'new_init') { } |
|
1 |
0 |
elsif ($xtra eq 'new_init') { } |
55
|
0 |
13 |
if defined &{"${pkg}::$sub";} |
61
|
12 |
13 |
unless (exists $$self{$sub}) |
64
|
6 |
6 |
if (not $rval) { } |
|
3 |
3 |
elsif ($rval =~ /ARRAY/) { } |
|
3 |
0 |
elsif ($rval =~ /HASH/) { } |
80
|
10 |
15 |
if ($#_ > 0) |
81
|
0 |
10 |
if ref $$subs{$sub} and not ref $value |
92
|
0 |
13 |
unless *{"${pkg}::$sub";} = sub {
my($self, $value) = @_;
unless (exists $$self{$sub}) {
my $val = $$subs{$sub};
my $rval = ref $val;
if (not $rval) {
$$self{$sub} = $val;
}
elsif ($rval =~ /ARRAY/) {
my(@val) = @{$val;};
$$self{$sub} = \@val;
}
elsif ($rval =~ /HASH/) {
my(%val) = %{$val;};
$$self{$sub} = \%val;
}
else {
$$self{$sub} = $val;
};
};
if ($#_ > 0) {
warn "The value supplied to '$sub()' is not of propper type" if ref $$subs{$sub} and not ref $value;
$$self{$sub} = $value;
return $self;
};
return $$self{$sub};
} |