File Coverage

blib/lib/Unicode/Precis/Preparation.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition 6 7 85.7
subroutine 7 7 100.0
pod 1 1 100.0
total 35 36 97.2


line stmt bran cond sub pod time code
1             #-*- perl -*-
2             #-*- coding: utf-8 -*-
3              
4             package Unicode::Precis::Preparation;
5              
6 4     4   518992 use 5.006001;
  4         22  
7 4     4   25 use strict;
  4         9  
  4         156  
8 4     4   23 use warnings;
  4         15  
  4         259  
9 4     4   2111 no utf8;
  4         1145  
  4         25  
10              
11 4     4   155 use base qw(Exporter);
  4         7  
  4         1120  
12              
13             our %EXPORT_TAGS = (
14             'all' => [
15             qw(prepare
16             ValidUTF8 FreeFormClass IdentifierClass
17             UNASSIGNED PVALID CONTEXTJ CONTEXTO DISALLOWED)
18             ],
19             );
20             our @EXPORT_OK = @{$EXPORT_TAGS{'all'}};
21              
22             our $VERSION = '2025.004';
23             our $XS_VERSION = $VERSION;
24             $VERSION = eval $VERSION; # see L
25              
26             require XSLoader;
27             XSLoader::load('Unicode::Precis::Preparation', $XS_VERSION);
28              
29 4     4   379 BEGIN { eval 'require Unicode::UCD'; }
30             my $UnicodeVersion;
31             if ($Unicode::UCD::VERSION) {
32             $UnicodeVersion = Unicode::UCD::UnicodeVersion();
33             } else {
34             # For Perl 5.6.x.
35             $UnicodeVersion = '3.0';
36             }
37              
38             sub prepare {
39 4613     4613 1 1712875 my $string = shift;
40 4613   100     17895 my $stringclass = shift || 0;
41 4613         12688 my %options = @_;
42              
43             my ($unicode_major, $unicode_minor) =
44 4613   66     21413 split /[.]/, ($options{UnicodeVersion} || $UnicodeVersion);
45 4613   100     19190 $unicode_minor ||= 0;
46              
47 4613         39340 _prepare($string, $stringclass, ($unicode_major << 8) + $unicode_minor);
48             }
49              
50             1;
51             __END__