OpenInteract2/I18N.pm

filter: Statementstmt 51.7% 15 / 29 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 41.3% 19 / 46 CC 5 SCAR 28.4
CC
5
Cov
39%
maketext
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 17.1
« OpenInteract2/Request/LWP.pm ↑ Summary OpenInteract2/Manage/Website/InstallPackage.pm »
1 package OpenInteract2::I18N;
2  
3 # $Id: I18N.pm,v 1.9 2005/03/18 04:09:48 lachoy Exp $
4  
5 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 87 ▶use base qw( Locale::Maketext );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 87 ▶use Log::Log4perl qw( get_logger );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 87 ▶use OpenInteract2::Constants qw( LOG_TRANSLATE );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 87 $OpenInteract2::I18N::VERSION = sprintf("%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/);
11  
12 87 my ( $log );
13  
14 # Override so we can add the message key to the output as required
15 # TODO: This may be a performance bottleneck...
16  
17 0 ▶sub maketext {
Subroutine maketext: not called CC=5 SCAR=34.0
Pod undocumented
18 0 my ( $self, $key, @args ) = @_;
19 0 ▶ $log ||= get_logger( LOG_TRANSLATE );
Condition0%0/3
$log ||= get_logger("OI2.TRANSLATE")
l!l&&r!l&&!r
000
MC/DC0%0/2
$log ||= get_logger("OI2.TRANSLATE")
$log get_logger("OI2.TRANSLATE")
Truth table0%0/3
A ||= B
A= $logB= get_logger("OI2.TRANSLATE")
ABresult
1X1
011
000
20  
21 0 $key =~ s/^\s+//;
22 0 $key =~ s/\s+$//;
23  
24 0 my ( $msg );
25 0 eval {
26 0 ▶ if ( $log->is_debug ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($log->is_debug) { } 0 0 0
27 0 $msg = "[$key] " . $self->SUPER::maketext( $key, @args );
28 }
29 else {
30 0 $msg = $self->SUPER::maketext( $key, @args );
31 }
32 };
33 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
34 0 $log->error( "Failed to translate '$key': $@" );;
35 0 return "Message error for '$key'";
36 }
37 $log->is_debug &&
38 0 ▶ $log->debug( "Message for key '$key': '$msg'; given ",
Branch: 1 branch
BranchTrueFalseTotal
$log->is_debug and $log->debug("Message for key '${key}': '${msg}'; given ", "args [", join("] [", @args), "]") 0 0 0
39 "args [", join( '] [', @args ), "]" );
40 0 return $msg;
41 }
42  
43 87 1;
44  
45 __END__
« OpenInteract2/Request/LWP.pm ↑ Summary OpenInteract2/Manage/Website/InstallPackage.pm »