File Coverage

blib/lib/SRU/Utils/XML.pm
Criterion Covered Total %
statement 9 22 40.9
branch 0 4 0.0
condition 0 2 0.0
subroutine 3 7 42.8
pod 4 4 100.0
total 16 39 41.0


line stmt bran cond sub pod time code
1             package SRU::Utils::XML;
2             {
3             $SRU::Utils::XML::VERSION = '1.01';
4             }
5             #ABSTRACT: XML utility functions for SRU
6              
7 2     2   11 use strict;
  2         4  
  2         80  
8 2     2   1425 use warnings;
  2         4  
  2         63  
9 2     2   10 use base qw( Exporter );
  2         4  
  2         672  
10              
11             our @EXPORT_OK = qw( element elementNoEscape escape stylesheet );
12              
13              
14             sub element {
15 0     0 1   my ($tag, $text) = @_;
16 0 0         return '' if ! defined $text;
17 0           return "<$tag>" . escape($text) . "";
18             }
19              
20              
21             sub elementNoEscape {
22 0     0 1   my ($tag, $text) = @_;
23 0 0         return '' if ! defined $text;
24 0           return "<$tag>$text";
25             }
26              
27              
28             sub escape {
29 0   0 0 1   my $text = shift || '';
30 0           $text =~ s/
31 0           $text =~ s/>/>/g;
32 0           $text =~ s/&/&/g;
33 0           return $text;
34             }
35              
36              
37             sub stylesheet {
38 0     0 1   my $uri = shift;
39 0           return qq();
40             }
41              
42             1;
43              
44             __END__