| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | if( $ENV{'maketext_obj'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | if( $ENV{'maketext_obj'}->can('maketext') ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
defined $/ && $/
MC/DC0%0/2
defined $/ && $/
defined $/
$/
Truth table0%0/3
A && B
A= defined $/B= $/
| |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | print $text . $/ if $text; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
defined $/ && $/
MC/DC0%0/2
defined $/ && $/
defined $/
$/
Truth table0%0/3
A && B
A= defined $/B= $/
| |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | return $text . $/ if $text; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
defined $/ && $/
MC/DC0%0/2
defined $/ && $/
defined $/
$/
Truth table0%0/3
A && B
A= defined $/B= $/
| |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | print $text . $/ if $text; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
defined $/ && $/
MC/DC0%0/2
defined $/ && $/
defined $/
$/
Truth table0%0/3
A && B
A= defined $/B= $/
| |||||||||||||||||||||||||||||
| 89 | 0 | ▶ | return $text . $/ if $text; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 0 | return; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 3 | 1; | |||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | __END__ | ||||||||||||||||||||||||||||