Framework.pm

filter: Statementstmt 82.6% 38 / 46 Branchbran 37.5% 3 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 91.6% 11 / 12 Podpod 80.0% 4 / 5 totaltotal 78.8% 56 / 71 CC 5 SCAR 7.2
CC
5
Cov
76%
init
6.0
set_translation
2.3
_T
2.1
CRAP 2.1
↑ Summary Framework/Dumb.pm »
1 package Locale::Framework;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Locale::Framework::Dumb;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = '0.06';
10  
11 1 require Exporter;
12 1 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use vars qw(@EXPORT);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 @EXPORT = qw(_T);
16  
17 1 my $backend=new Locale::Framework::Dumb;
18 1 my $language="en";
19  
20 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
21 1 my $class=shift;
22 1 my $self;
23  
24 1 $self->{"nil"}=1;
25 1 bless $self,$class;
26 1 return $self;
27 }
28  
29 0 ▶sub init {
Subroutine init: not called CC=2 SCAR=17.9
Pod documented
30 0 my $self=shift;
31 0 my $lang_backend;
32 0 ▶ if (ref($self) eq "Locale::Framework") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self eq 'Locale::Framework') { } 0 0 0
33 0 $lang_backend=shift;
34 }
35 else {
36 0 $lang_backend=$self;
37 }
38 0 $backend=$lang_backend;
39 }
40  
41 3 ▶sub _T {
Subroutine _T: called CC=2 SCAR=7.6
42 3 my $text=shift;
43 3 ▶ if (ref($text) eq "Locale::Framework") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $text eq "Locale::Framework") 0 3 3
44 0 $text=shift;
45 }
46 3 return $backend->translate($language,$text);
47 }
48  
49 1 ▶sub clear_cache {
Subroutine clear_cache: called CC=1 SCAR=0.0
Pod documented
50 1 $backend->clear_cache();
51 }
52  
53 2 ▶sub language {
Subroutine language: called CC=2 SCAR=7.0
Pod documented
54 2 my $l=shift;
55 2 ▶ if (ref($l) eq "Locale::Framework") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $l eq "Locale::Framework") 2 0 2
56 2 $l=shift;
57 }
58 2 $language=$l;
59 }
60  
61 1 ▶sub set_translation {
Subroutine set_translation: called CC=2 SCAR=8.1
Pod documented
62 1 ▶ if (ref($_[0]) eq "Locale::Framework") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq "Locale::Framework") 0 1 1
63 0 shift;
64 }
65 1 $backend->set_translation($language,@_);
66 }
67  
68  
69 1 1;
70 __END__
↑ Summary Framework/Dumb.pm »