File Coverage

lib/XML/Compile/C14N/Util.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 27 27 100.0


line stmt bran cond sub pod time code
1             # Copyrights 2011-2020 by [Mark Overmeer ].
2             # For other contributors see ChangeLog.
3             # See the manual pages for details on the licensing terms.
4             # Pod stripped from pm file by OODoc 2.02.
5             # This code is part of distribution XML-Compile-C14N. Meta-POD processed
6             # with OODoc into POD and HTML manual-pages. See README.md
7             # Copyright Mark Overmeer. Licensed under the same terms as Perl itself.
8              
9             package XML::Compile::C14N::Util;
10 2     2   84208 use vars '$VERSION';
  2         13  
  2         104  
11             $VERSION = '0.95';
12              
13 2     2   12 use base 'Exporter';
  2         4  
  2         177  
14              
15 2     2   12 use warnings;
  2         3  
  2         41  
16 2     2   9 use strict;
  2         3  
  2         260  
17              
18             my @c14n = qw/
19             C14N_v10_NO_COMM
20             C14N_v10_COMMENTS
21             C14N_v11_NO_COMM
22             C14N_v11_COMMENTS
23             C14N_EXC_NO_COMM
24             C14N_EXC_COMMENTS
25             C14N_EXC_NS
26             /;
27              
28             my @paths = qw/
29             C14N10
30             C14N11
31             C14NEXC
32             is_canon_constant
33             /;
34              
35             our @EXPORT = qw/C14N_EXC_NS/;
36             our @EXPORT_OK = (@c14n, @paths);
37              
38             our %EXPORT_TAGS =
39             ( c14n => \@c14n
40             , paths => \@paths
41             );
42              
43              
44             # Path components
45             use constant
46 2         277 { C14N10 => 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'
47             , C14N11 => 'http://www.w3.org/2006/12/xml-c14n11'
48             , C14NEXC => 'http://www.w3.org/2001/10/xml-exc-c14n'
49 2     2   16 };
  2         4  
50              
51              
52             use constant
53 2         393 { C14N_v10_NO_COMM => C14N10
54             , C14N_v10_COMMENTS => C14N10. '#WithComments'
55             , C14N_v11_NO_COMM => C14N11
56             , C14N_v11_COMMENTS => C14N11. '#WithComments'
57             , C14N_EXC_NO_COMM => C14NEXC.'#'
58             , C14N_EXC_COMMENTS => C14NEXC.'#WithComments'
59             , C14N_EXC_NS => C14NEXC.'#'
60 2     2   12 };
  2         2  
61              
62              
63             my $is_canon = qr/^(?:\Q${\C14N10}\E|\Q${\C14N11}\E|\Q${\C14NEXC}\E)\b/;
64 8     8 1 147 sub is_canon_constant($) { $_[0] =~ $is_canon }
65              
66             1;