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   229520 use 5.006001;
  4         38  
7 4     4   19 use strict;
  4         5  
  4         104  
8 4     4   19 use warnings;
  4         11  
  4         129  
9 4     4   2104 no utf8;
  4         50  
  4         17  
10              
11 4     4   114 use base qw(Exporter);
  4         7  
  4         800  
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 = '0.999_01';
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   244 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 740514 my $string = shift;
40 4613   100     12222 my $stringclass = shift || 0;
41 4613         8475 my %options = @_;
42              
43             my ($unicode_major, $unicode_minor) =
44 4613   66     13200 split /[.]/, ($options{UnicodeVersion} || $UnicodeVersion);
45 4613   100     14401 $unicode_minor ||= 0;
46              
47 4613         23517 _prepare($string, $stringclass, ($unicode_major << 4) + $unicode_minor);
48             }
49              
50             1;
51             __END__