blib/lib/Encode/Encoding.pm

filter: Statementstmt 88.8% 40 / 45 Branchbran 37.5% 3 / 8 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 77.7% 14 / 18 Podpod 72.7% 8 / 11 totaltotal 80.0% 68 / 85 CC 6 SCAR 6.3
CC
6
Cov
82%
decode
6.0
perlio_ok
2.1
encode
2.0
CRAP 1.9
« bin/piconv ↑ Summary blib/lib/Encode/KR/2022_KR.pm »
1 package Encode::Encoding;
2  
3 # Base class for classes which implement encodings
4 69 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 69 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 69 our $VERSION = '2.09';
7  
8 69 our @CARP_NOT = qw(Encode Encode::Encoder);
9  
10 69 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 69 ▶use Encode ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 69 ▶use Encode::MIME::Name;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 69 ▶use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG};
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 28 ▶sub Define {
Subroutine Define: called CC=2 SCAR=7.0
Pod undocumented
17 28 my $obj = shift;
18 28 my $canonical = shift;
19 28 ▶ $obj = bless { Name => $canonical }, $obj unless ref $obj;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $obj 28 0 28
20  
21 # warn "$canonical => $obj\n";
22 28 Encode::define_encoding( $obj, $canonical, @_ );
23 }
24  
25 598 ▶sub name { return shift->{'Name'} }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
26  
27 25 ▶sub mime_name {
Subroutine mime_name: called CC=1 SCAR=0.0
Pod documented
28 25 return Encode::MIME::Name::get_mime_name(shift->name);
29 }
30  
31 88 ▶sub renew {
Subroutine renew: called CC=1 SCAR=0.0
Pod documented
32 88 my $self = shift;
33 88 my $clone = bless {%$self} => ref($self);
34 88 $clone->{renewed}++; # so the caller can see it
35 88 DEBUG and warn $clone->{renewed};
36 88 return $clone;
37 }
38  
39 30891 ▶sub renewed { return $_[0]->{renewed} || 0 }
Subroutine renewed: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{'renewed'} || 0
l!l
34930542
MC/DC100%1/1
$_[0]{'renewed'} || 0
$_[0]{'renewed'}
Truth table100%2/2
A
A= $_[0]{'renewed'}
Aresult
11
00
40  
41 69 *new_sequence = \&renew;
42  
43 86 ▶sub needs_lines { 0 }
Subroutine needs_lines: called CC=1 SCAR=0.0
Pod documented
44  
45 8 ▶sub perlio_ok {
Subroutine perlio_ok: called CC=2 SCAR=7.2
Pod documented
46 8 ▶ return eval { require PerlIO::encoding } ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
eval { do { require PerlIO::encoding } } ? : 8 0 8
47 }
48  
49 # (Temporary|legacy) methods
50  
51 0 ▶sub toUnicode { shift->decode(@_) }
Subroutine toUnicode: not called CC=1 SCAR=6.9
Pod undocumented
52 0 ▶sub fromUnicode { shift->encode(@_) }
Subroutine fromUnicode: not called CC=1 SCAR=6.9
Pod undocumented
53  
54 #
55 # Needs to be overloaded or just croak
56 #
57  
58 1 ▶sub encode {
Subroutine encode: called CC=2 SCAR=7.1
Pod documented
59 1 my $obj = shift;
60 1 ▶ my $class = ref($obj) ? ref($obj) : $obj;
Branch: 1 branch
BranchTrueFalseTotal
ref $obj ? : 1 0 1
61 1 Carp::croak( $class . "->encode() not defined!" );
62 }
63  
64 0 ▶sub decode {
Subroutine decode: not called CC=2 SCAR=17.9
Pod documented
65 0 my $obj = shift;
66 0 ▶ my $class = ref($obj) ? ref($obj) : $obj;
Branch: 1 branch
BranchTrueFalseTotal
ref $obj ? : 0 0 0
67 0 Carp::croak( $class . "->encode() not defined!" );
68 }
69  
70 0 ▶sub DESTROY { }
Subroutine DESTROY: not called CC=1 SCAR=0.0
71  
72 69 1;
73 __END__
« bin/piconv ↑ Summary blib/lib/Encode/KR/2022_KR.pm »