blib/lib/Locale/Maketext/Pseudo.pm

filter: Statementstmt 39.5% 19 / 48 Branchbran 10.7% 3 / 28 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 30.7% 4 / 13 Podpod 100% 11 / 11 totaltotal 30.8% 37 / 120 CC 20 SCAR 27.3
CC
20
Cov
25%
env_maketext
30.0
env_say
20.0
env_get
20.0
CRAP 15.4
↑ Summary
1 package Locale::Maketext::Pseudo;
2  
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 $Locale::Maketext::Pseudo::VERSION = '0.6';
7 3 require Exporter;
8 3 @Locale::Maketext::Pseudo::ISA = qw(Exporter);
9 3 @Locale::Maketext::Pseudo::EXPORT_OK = qw(env_maketext env_print env_fetch env_say env_get);
10  
11 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod documented
12 1 my($class, $args_ref) = @_;
13 1 my $self = bless {}, $class;
14 1 ▶ $ENV{'maketext_obj'} = $self if !$args_ref->{'skip_env'};
Branch: 1 branch
BranchTrueFalseTotal
unless $args_ref->{"skip_env"} 1 0 1
15 1 return $self;
16 }
17  
18 0 ▶sub env_maketext {
Subroutine env_maketext: not called CC=5 SCAR=34.0
Pod documented
19 0 my ($string, @args) = @_;
20
21 0 my $needs_elp = 1;
22 0 ▶ if( exists $ENV{'maketext_obj'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $ENV{"maketext_obj"}) 0 0 0
23 0 ▶ if( $ENV{'maketext_obj'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"maketext_obj"}) 0 0 0
24 0 ▶ if( $ENV{'maketext_obj'}->can('maketext') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"maketext_obj"}->can("maketext")) 0 0 0
25 0 $string = $ENV{'maketext_obj'}->maketext( $string, @args );
26 0 $needs_elp = 0;
27 }
28 }
29 }
30
31 0 ▶ if( $needs_elp ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($needs_elp) 0 0 0
32 0 require Local::Maketext::Pseudo;
33 Local::Maketext::Pseudo->new({
34 0 'skip_env' => $ENV{'maketext_obj_skip_env'}
35 })->maketext( $string, @args );
36 }
37
38 0 return $string;
39 }
40  
41 0 ▶sub env_print {
Subroutine env_print: not called CC=1 SCAR=6.9
Pod documented
42 0 print env_maketext(@_);
43 }
44  
45 0 ▶sub env_fetch {
Subroutine env_fetch: not called CC=1 SCAR=6.9
Pod documented
46 0 return env_maketext(@_);
47 }
48
49 0 ▶sub env_say {
Subroutine env_say: not called CC=4 SCAR=30.0
Pod documented
50 0 my $text = env_maketext(@_);
51 0 ▶ local $/ = !defined $/ || !$/ ? "\n" : $/; # otherwise assume they are not stupid
Branch: 1 branch
BranchTrueFalseTotal
!(defined $/ && $/) ? : 0 0 0
Condition0%0/3
defined $/ && $/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $/ && $/
defined $/ $/
Truth table0%0/3
A && B
A= defined $/B= $/
ABresult
0X0
100
111
52 0 ▶ print $text . $/ if $text;
Branch: 1 branch
BranchTrueFalseTotal
if $text 0 0 0
53 }
54
55 0 ▶sub env_get {
Subroutine env_get: not called CC=4 SCAR=30.0
Pod documented
56 0 my $text = env_maketext(@_);
57 0 ▶ local $/ = !defined $/ || !$/ ? "\n" : $/; # otherwise assume they are not stupid
Branch: 1 branch
BranchTrueFalseTotal
!(defined $/ && $/) ? : 0 0 0
Condition0%0/3
defined $/ && $/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $/ && $/
defined $/ $/
Truth table0%0/3
A && B
A= defined $/B= $/
ABresult
0X0
100
111
58 0 ▶ return $text . $/ if $text;
Branch: 1 branch
BranchTrueFalseTotal
if $text 0 0 0
59 0 return;
60 }
61  
62 5 ▶sub maketext {
Subroutine maketext: called CC=3 SCAR=11.0
Pod documented
63 5 my ($fake, $string, @args) = @_;
64  
65 5 for my $idx ( 1 .. scalar(@args)) {
66 10 ▶ $string =~ s{ \[ [_]( [-]?$idx ) \] }{$args[ substr($1, 0, 1) eq '-' ? $1 : ($1 - 1) ]}xmsg;
Branch: 1 branch
BranchTrueFalseTotal
substr($1, 0, 1) eq '-' ? : 2 11 13
67 }
68  
69 5 return $string;
70 }
71  
72 0 ▶sub print {
Subroutine print: not called CC=1 SCAR=6.9
Pod documented
73 0 print shift->maketext(@_);
74 }
75  
76 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
Pod documented
77 0 return shift->maketext(@_);
78 }
79
80 0 ▶sub say {
Subroutine say: not called CC=4 SCAR=30.0
Pod documented
81 0 my $text = shift->maketext(@_);
82 0 ▶ local $/ = !defined $/ || !$/ ? "\n" : $/; # otherwise assume they are not stupid
Branch: 1 branch
BranchTrueFalseTotal
!(defined $/ && $/) ? : 0 0 0
Condition0%0/3
defined $/ && $/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $/ && $/
defined $/ $/
Truth table0%0/3
A && B
A= defined $/B= $/
ABresult
0X0
100
111
83 0 ▶ print $text . $/ if $text;
Branch: 1 branch
BranchTrueFalseTotal
if $text 0 0 0
84 }
85
86 0 ▶sub get {
Subroutine get: not called CC=4 SCAR=30.0
Pod documented
87 0 my $text = shift->maketext(@_);
88 0 ▶ local $/ = !defined $/ || !$/ ? "\n" : $/; # otherwise assume they are not stupid
Branch: 1 branch
BranchTrueFalseTotal
!(defined $/ && $/) ? : 0 0 0
Condition0%0/3
defined $/ && $/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $/ && $/
defined $/ $/
Truth table0%0/3
A && B
A= defined $/B= $/
ABresult
0X0
100
111
89 0 ▶ return $text . $/ if $text;
Branch: 1 branch
BranchTrueFalseTotal
if $text 0 0 0
90 0 return;
91 }
92  
93 3 1;
94  
95 __END__
↑ Summary