blib/lib/XML/Atom.pm

filter: Statementstmt 68.0% 34 / 50 Branchbran 25.0% 2 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 56.2% 9 / 16 Podpod 0.0% 0 / 2 totaltotal 59.2% 45 / 76 SCAR 18.5
CC
5
Cov
62%
__ANON__
12.0
BEGIN
4.4
__ANON__
2.0
CRAP 6.4
« blib/lib/XML/Atom/ErrorHandler.pm ↑ Summary blib/lib/XML/Atom/Entry.pm »
1 # $Id$
2  
3 package XML::Atom;
4 22 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 22 ▶use 5.008_001;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 22 our $VERSION = '0.42';
8  
9 BEGIN {
10 22 ▶ @XML::Atom::EXPORT = qw( LIBXML DATETIME);
Subroutine BEGIN: called CC=3 SCAR=14.8
11 22 ▶ if (eval { require XML::LibXML }) {
Branch: 1 branch
BranchTrueFalseTotal
if (eval { do { require XML::LibXML } }) { } 22 0 22
12 22 *{XML::Atom::LIBXML} = sub() {1};
13 } else {
14 0 require XML::XPath;
15 0 *{XML::Atom::LIBXML} = sub() {0};
16 }
17 22 ▶ if (eval { require DateTime::Format::Atom }) {
Branch: 1 branch
BranchTrueFalseTotal
if (eval { do { require DateTime::Format::Atom } }) { } 0 22 22
18 0 *{XML::Atom::DATETIME} = sub() {1};
19 } else {
20 22 *{XML::Atom::DATETIME} = sub() {0};
21 }
22
23 22 local $^W = 0;
24 *XML::XPath::Function::namespace_uri = sub {
25 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=3 SCAR=24.8
26 0 my($node, @params) = @_;
27 0 my $ns = $node->getNamespace($node->getPrefix);
28 0 ▶ if (!$ns) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ns) 0 0 0
29 0 $ns = ($node->getNamespaces)[0];
30 }
31 0 ▶ XML::XPath::Literal->new($ns ? $ns->getExpanded : '');
Branch: 1 branch
BranchTrueFalseTotal
$ns ? : 0 0 0
32 22 };
33  
34 22 $XML::Atom::ForceUnicode = 0;
35 22 $XML::Atom::DefaultVersion = 0.3;
36 }
37  
38 sub libxml_parser {
39 ## uses old XML::LibXML < 1.70 interface for compat reasons
40 return XML::LibXML->new(
41 #no_network => 1, # v1.63+
42 expand_xinclude => 0,
43 expand_entities => 1,
44 load_ext_dtd => 0,
45 0 ▶ ext_ent_handler => sub { warn "External entities disabled."; '' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
46 27 ▶ );
Subroutine libxml_parser: called CC=1 SCAR=0.0
Pod undocumented
47 }
48  
49 sub expat_parser {
50 return XML::Parser->new(
51 Handlers => {
52 0 ▶ ExternEnt => sub { warn "External Entities disabled."; '' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
53 ▶ ExternEntFin => sub {},
Subroutine __ANON__: not called CC=1 SCAR=0.0
54 },
55 0 ▶ );
Subroutine expat_parser: not called CC=1 SCAR=6.9
Pod undocumented
56 }
57  
58 22 ▶use base qw( XML::Atom::ErrorHandler Exporter );
Subroutine BEGIN: called CC=1 SCAR=0.0
59  
60 package XML::Atom::Namespace;
61 22 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63 sub new {
64 7 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
65 7 my($prefix, $uri) = @_;
66 7 bless { prefix => $prefix, uri => $uri }, $class;
67 }
68  
69 ▶sub DESTROY { }
Subroutine DESTROY: not called CC=1 SCAR=0.0
70  
71 22 ▶use vars qw( $AUTOLOAD );
Subroutine BEGIN: called CC=1 SCAR=0.0
72 sub AUTOLOAD {
73 0 ▶ (my $var = $AUTOLOAD) =~ s!.+::!!;
Subroutine AUTOLOAD: not called CC=1 SCAR=0.6
74 22 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
75 0 ($_[0], $var);
76 }
77  
78 22 1;
79 __END__
80  
81 =head1 NAME
82  
83 XML::Atom - Atom feed and API implementation
84  
85 =head1 SYNOPSIS
86  
87 use XML::Atom;
88  
89 =head1 DESCRIPTION
90  
91 Atom is a syndication, API, and archiving format for weblogs and other
92 data. I<XML::Atom> implements the feed format as well as a client for the
93 API.
94  
95 =head1 LICENSE
96  
97 I<XML::Atom> is free software; you may redistribute it and/or modify it
98 under the same terms as Perl itself.
99  
100 =head1 AUTHOR
101  
102 Benjamin Trott, Tatsuhiko Miyagawa
103  
104 =head1 COPYRIGHT
105  
106 All rights reserved.
107  
108 =cut
« blib/lib/XML/Atom/ErrorHandler.pm ↑ Summary blib/lib/XML/Atom/Entry.pm »