lib/usw.pm

filter: Statementstmt 100% 37 / 37 Branchbran 87.5% 7 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod n/a totaltotal 98.2% 56 / 57 CC 5 SCAR 6.3
CC
5
Cov
98%
import
4.0
_redecode
2.0
BEGIN
1.0
CRAP 1.9
« blib/lib/usww.pm ↑ Summary Build »
1 package usw;
2 10 ▶use 5.012005;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 10 our $VERSION = "0.06";
5  
6 10 ▶use Encode qw(is_utf8 encode_utf8 decode_utf8);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 10 ▶use utf8();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use strict();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 ▶use warnings();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 10 ▶use List::Util qw(first);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub import {
13 9 ▶ utf8->import;
Subroutine import: called CC=4 SCAR=13.9
14 9 strict->import;
15 9 warnings->import( 'all', FATAL => 'recursion' );
16  
17 #binmode \*STDIN, ":encoding(UTF-8)";
18 9 ▶ binmode \*STDOUT, ":encoding(UTF-8)";
Subroutine BEGIN: called CC=1 SCAR=0.0
19 9 binmode \*STDERR, ":encoding(UTF-8)";
20 9 ▶ return unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 9 9
21  
22 9 ▶ $SIG{__WARN__} = \&_redecode if first { $_ eq 'warn' } @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if &first(sub { $_ eq "warn"; } , @_) 1 8 9
23 3 ▶ $SIG{__DIE__} = sub { die _redecode(@_) }
Subroutine __ANON__: called CC=1 SCAR=0.0
24 9 ▶ if first { $_ eq 'die' } @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if &first(sub { $_ eq "die"; } , @_) 1 8 9
25  
26 9 return;
27 }
28  
29 sub _redecode {
30 6 ▶ $_[0] =~ /^(.+) at (.+) line (\d+)\.$/;
Subroutine _redecode: called CC=2 SCAR=6.9
31 6 my @texts = split $2, $_[0];
32 6 ▶ return is_utf8($1)
Branch: 1 branch
BranchTrueFalseTotal
&is_utf8($1) ? : 2 4 6
33 ? $texts[0] . decode_utf8 $2. $texts[1]
34 : decode_utf8 $_[0];
35 }
36  
37 10 1;
38  
39 __END__
« blib/lib/usww.pm ↑ Summary Build »