RecodeData/_Encode.pm

filter: Statementstmt 100% 28 / 28 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 95.2% 40 / 42 CC 5 SCAR 11.0
CC
5
Cov
94%
_recode
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« RecodeData/VISCII.pm ↑ Summary RecodeData.pm »
1 #! /bin/false
2 # vim: set autoindent shiftwidth=4 tabstop=4:
3  
4 # Interface to Encode.
5 # Copyright (C) 2002-2026 Guido Flohr <guido.flohr@cantanea.com>,
6 # all rights reserved.
7  
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12  
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17  
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20  
21 package Locale::RecodeData::_Encode;
22  
23 34 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 34 ▶use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 34 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 34 require Locale::RecodeData;
29 34 ▶use base qw (Locale::RecodeData);
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 sub _recode
32 130543 ▶{
Subroutine _recode: called CC=5 SCAR=16.1
33 34 ▶ use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 130543 my $retval;
36
37 130543 ▶ if ($_[0]->{_from} eq 'INTERNAL') {
Branch: 2 branches
BranchTrueFalseTotal
if ($_[0]{'_from'} eq 'INTERNAL') { } 61304 69239 130543
elsif ($_[0]{'_to'} eq 'INTERNAL') { } 61243 7996 69239
38 61304 $_[1] = pack "N*", @{$_[1]};
39 61304 $retval = Encode::from_to ($_[1], 'UTF-32BE', $_[0]->{_to});
40 } elsif ($_[0]->{_to} eq 'INTERNAL') {
41 61243 $retval = Encode::from_to ($_[1], $_[0]->{_from}, 'UTF-32BE');
42 61243 ▶ return unless defined $retval;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $retval 0 61243 61243
43 61243 $_[1] = [ unpack "N*", $_[1] ];
44 } else {
45 7996 $retval = Encode::from_to ($_[1], $_[0]->{_from}, $_[0]->{_to});
46 }
47
48 130543 ▶ return unless defined $retval;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $retval 0 130543 130543
49 130543 return 1;
50 }
51  
52 34 1;
53  
54 __END__
« RecodeData/VISCII.pm ↑ Summary RecodeData.pm »