Chunks/Local.pm

filter: Statementstmt 24.2% 8 / 33 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod 100% 5 / 5 totaltotal 30.6% 15 / 49 CC 5 SCAR 19.8
CC
5
Cov
22%
output
12.0
guessLanguage
12.0
new
2.0
CRAP 7.3
« Chunks.pm ↑ Summary
1 package HTML::Chunks::Local;
2  
3 1 our $VERSION = "1.02";
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use base qw(HTML::Chunks);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub new
9 0 ▶{
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
10 0 my $class = shift;
11 0 my $self = $class->SUPER::new(@_);
12
13 0 $self->{langdefaults} = [];
14  
15 0 return $self;
16 }
17  
18 0 ▶sub output {
Subroutine output: not called CC=3 SCAR=24.8
Pod documented
19 0 my $self = shift;
20 0 my $name = shift;
21 0 my $uselang = shift;
22  
23 0 foreach my $lang (@{$uselang}, @{$self->{langdefaults}}) {
24 0 ▶ if (defined($self->{chunk}{"$name\_$lang"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"chunk"}{"${name}_$lang"}) 0 0 0
25 0 return $self->SUPER::output("$name\_$lang", @_);
26 }
27 }
28 # our last default is the chunk name with no language suffix
29 0 return $self->SUPER::output($name, @_);
30 }
31  
32 0 ▶sub setLangDefaults {
Subroutine setLangDefaults: not called CC=1 SCAR=6.9
Pod documented
33 0 my $self = shift;
34 0 ($self->{langdefaults}) = @_;
35 }
36  
37 0 ▶sub getLangDefaults {
Subroutine getLangDefaults: not called CC=1 SCAR=6.9
Pod documented
38 0 my $self = shift;
39 0 return $self->{langdefaults};
40 }
41  
42 0 ▶sub guessLanguage {
Subroutine guessLanguage: not called CC=3 SCAR=24.8
Pod documented
43 0 my $self = shift;
44 0 my @return;
45
46 0 foreach my $lang (@_) {
47 0 $lang =~ s/\-/\_/;
48 0 push(@return, $lang);
49 0 ▶ if ($lang =~ /(.+)\_/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lang =~ /(.+)\_/) 0 0 0
50 0 push(@return, $1);
51 }
52 }
53 0 return \@return;
54 }
55  
56 1 1;
57  
58 __END__
« Chunks.pm ↑ Summary