blib/lib/XML/Easy/Text.pm

filter: Statementstmt 99.2% 251 / 253 Branchbran 94.2% 132 / 140 Conditioncond 77.7% 7 / 9 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 97.6% 41 / 42 Podpod 100% 10 / 10 totaltotal 96.7% 443 / 458 SCAR 43.1
CC
74
Cov
97%
_serialise_element
11.0
_parse_reference
9.0
_parse_element
9.0
CRAP 74.1
↑ Summary blib/lib/XML/Easy/Classify.pm »
1 =head1 NAME
2  
3 XML::Easy::Text - XML parsing and serialisation
4  
5 =head1 SYNOPSIS
6  
7 use XML::Easy::Text qw(
8 xml10_read_content_object xml10_read_element
9 xml10_read_document xml10_read_extparsedent_object
10 );
11  
12 $content = xml10_read_content_object($text);
13 $element = xml10_read_element($text);
14 $element = xml10_read_document($text);
15 $content = xml10_read_extparsedent_object($text);
16  
17 use XML::Easy::Text qw(
18 xml10_write_content xml10_write_element
19 xml10_write_document xml10_write_extparsedent
20 );
21  
22 $text = xml10_write_content($content);
23 $text = xml10_write_element($element);
24 $text = xml10_write_document($element, "UTF-8");
25 $text = xml10_write_extparsedent($content, "UTF-8");
26  
27 =head1 DESCRIPTION
28  
29 This module supplies functions that parse and serialise XML data
30 according to the XML 1.0 specification.
31  
32 This module is oriented towards the use of XML to represent data
33 for interchange purposes, rather than the use of XML as markup of
34 principally textual data. It does not perform any schema processing,
35 and does not interpret DTDs or any other kind of schema. It adheres
36 strictly to the XML specification, in all its awkward details, except
37 for the aforementioned DTDs.
38  
39 XML data in memory is represented using a tree of
40 L<XML::Easy::Content> and L<XML::Easy::Element>
41 objects. Such a tree encapsulates all the structure and data content
42 of an XML element or document, without any irrelevant detail resulting
43 from the textual syntax.
44 These node trees are readily manipulated by the functions
45 in L<XML::Easy::NodeBasics>.
46  
47 The functions of this module are implemented
48 in C for performance, with a pure Perl backup version (which has good
49 performance compared to other pure Perl parsers) for systems that can't
50 handle XS modules.
51  
52 =cut
53  
54 package XML::Easy::Text;
55  
56 9 ▶{ use 5.008; }
Subroutine BEGIN: called CC=1 SCAR=0.0
57 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
59  
60 9 ▶use XML::Easy::Content 0.007 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
61 9 ▶use XML::Easy::Element 0.007 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63 9 our $VERSION = "0.010";
64  
65 9 ▶use parent "Exporter";
Subroutine BEGIN: called CC=1 SCAR=0.0
66 9 our @EXPORT_OK = qw(
67 xml10_read_content_object xml10_read_content_twine
68 xml10_read_content
69 xml10_read_element
70 xml10_read_document
71 xml10_read_extparsedent_object xml10_read_extparsedent_twine
72 xml10_read_extparsedent
73 xml10_write_content xml10_write_element
74 xml10_write_document xml10_write_extparsedent
75 );
76  
77 9 eval { local $SIG{__DIE__};
78 9 require XSLoader;
79 9 ▶ XSLoader::load("XML::Easy", $VERSION)
Branch: 1 branch
BranchTrueFalseTotal
unless defined &XML::Easy::Text::xml10_write_document 9 0 9
80 unless defined &xml10_write_document;
81 };
82  
83 9 ▶if($@ eq "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($@ eq '') { } 0 9 9
84 0 close(DATA);
85 } else {
86 9 (my $filename = __FILE__) =~ tr# -~##cd;
87 9 local $/ = undef;
88 9 my $pp_code = "#line 98 \"$filename\"\n".<DATA>;
89 9 close(DATA);
90 {
91 9 local $SIG{__DIE__};
92 9 eval $pp_code;
93 }
94 9 ▶ die $@ if $@ ne "";
Branch: 1 branch
BranchTrueFalseTotal
if $@ ne "" 0 9 9
95 }
96  
97 9 *xml10_read_content = \&xml10_read_content_twine;
98 9 *xml10_read_extparsedent = \&xml10_read_extparsedent_twine;
99 9 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
100 9 1;
101  
102 __DATA__
↑ Summary blib/lib/XML/Easy/Classify.pm »