Stringprep/_Common.pm

filter: Statementstmt 100% 34 / 34 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 97.7% 43 / 44 CC 5 SCAR 7.9
CC
5
Cov
97%
_mk_map
3.0
_mk_set
3.0
BEGIN
1.0
CRAP 2.2
« Stringprep.pm ↑ Summary Stringprep/BiDi.pm »
1 package Unicode::Stringprep::_Common;
2  
3 12 require 5.008_003;
4  
5 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 12 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 12 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 12 our $VERSION = "1.10";
12 12 $VERSION = eval { $VERSION };
13  
14 12 our @ISA = ('Exporter');
15 12 our @EXPORT = ('_mk_set', '_mk_map');
16  
17 168 ▶sub _mk_set {
Subroutine _mk_set: called CC=3 SCAR=11.0
18 168 my @data = ();
19 168 foreach my $line (split /\n/, shift) {
20 10452 my($from,$comment) = split /;/, $line;
21 10452 $from =~ s/[^0-9A-Z-]//gi;
22 10452 ($from,my $to) = split(/-/, $from, 2);
23 10452 ▶ push @data, (hex($from), ($to ? hex($to) : undef));
Branch: 1 branch
BranchTrueFalseTotal
$to ? : 7020 3432 10452
24 }
25 168 return @data;
26 };
27  
28 36 ▶sub _mk_map {
Subroutine _mk_map: called CC=3 SCAR=11.0
29 36 my @data = ();
30 36 foreach my $line (split /\n/, shift) {
31 26832 my($from,$to,$comment) = split /;/, $line;
32 26832 $from =~ s/[^0-9A-F]//gi;
33 26832 $to =~ s/[^0-9A-F ]//gi;
34 push @data,
35 hex($from),
36 join('',map {
37 26832 ▶ $_ eq ''
Branch: 1 branch
BranchTrueFalseTotal
$_ eq '' ? : 0 30216 30216
38 ? ''
39 : chr(hex($_))
40 }
41 split(' ', $to));
42 }
43 36 return @data;
44 };
45  
46 12 1;
47  
48 =head1 NAME
49  
50 Unicode::Stringprep::_Common - Internal functions for C<Unicode::Stringprep::*>
51  
52 =head1 AUTHOR
53  
54 Claus FE<auml>rber E<lt>CFAERBER@cpan.orgE<gt>
55
56 =head1 LICENSE
57
58 Copyright 2007-2009 Claus FE<auml>rber. All rights reserved.
59
60 This library is free software; you can redistribute it and/or
61 modify it under the same terms as Perl itself.
« Stringprep.pm ↑ Summary Stringprep/BiDi.pm »