File Coverage

blib/lib/XML/Compile/C14N/Util.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 23 23 100.0


line stmt bran cond sub pod time code
1             # Copyrights 2011-2014 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.01.
5 1     1   21460 use warnings;
  1         3  
  1         29  
6 1     1   4 use strict;
  1         2  
  1         57  
7              
8             package XML::Compile::C14N::Util;
9             our $VERSION = '0.94';
10              
11 1     1   4 use base 'Exporter';
  1         2  
  1         190  
12              
13             my @c14n = qw/
14             C14N_v10_NO_COMM
15             C14N_v10_COMMENTS
16             C14N_v11_NO_COMM
17             C14N_v11_COMMENTS
18             C14N_EXC_NO_COMM
19             C14N_EXC_COMMENTS
20             C14N_EXC_NS
21             /;
22              
23             my @paths = qw/
24             C14N10
25             C14N11
26             C14NEXC
27             is_canon_constant
28             /;
29              
30             our @EXPORT = qw/C14N_EXC_NS/;
31             our @EXPORT_OK = (@c14n, @paths);
32              
33             our %EXPORT_TAGS =
34             ( c14n => \@c14n
35             , paths => \@paths
36             );
37              
38              
39             # Path components
40             use constant
41 1         181 { C14N10 => 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'
42             , C14N11 => 'http://www.w3.org/2006/12/xml-c14n11'
43             , C14NEXC => 'http://www.w3.org/2001/10/xml-exc-c14n'
44 1     1   5 };
  1         2  
45              
46              
47             use constant
48 1         193 { C14N_v10_NO_COMM => C14N10
49             , C14N_v10_COMMENTS => C14N10. '#WithComments'
50             , C14N_v11_NO_COMM => C14N11
51             , C14N_v11_COMMENTS => C14N11. '#WithComments'
52             , C14N_EXC_NO_COMM => C14NEXC.'#'
53             , C14N_EXC_COMMENTS => C14NEXC.'#WithComments'
54             , C14N_EXC_NS => C14NEXC.'#'
55 1     1   4 };
  1         1  
56              
57              
58             my $is_canon = qr/^(?:\Q${\C14N10}\E|\Q${\C14N11}\E|\Q${\C14NEXC}\E)\b/;
59 8     8 1 68 sub is_canon_constant($) { $_[0] =~ $is_canon }
60              
61             1;