File Coverage

blib/lib/XML/Atom.pm
Criterion Covered Total %
statement 9 25 36.0
branch 1 8 12.5
condition n/a
subroutine 3 3 100.0
pod n/a
total 13 36 36.1


line stmt bran cond sub pod time code
1             # $Id$
2              
3             package XML::Atom;
4 23     23   5053 use strict;
  23         69  
  23         844  
5              
6 23     23   1046 use 5.008_001;
  23         156  
7             our $VERSION = '0.42';
8              
9             BEGIN {
10 23     23   189 @XML::Atom::EXPORT = qw( LIBXML DATETIME);
11 23 50       68 if (eval { require XML::LibXML }) {
  23         5518  
12 0         0 *{XML::Atom::LIBXML} = sub() {1};
13             } else {
14 23         13504 require XML::XPath;
15 0           *{XML::Atom::LIBXML} = sub() {0};
16             }
17 0 0         if (eval { require DateTime::Format::Atom }) {
  0            
18 0           *{XML::Atom::DATETIME} = sub() {1};
19             } else {
20 0           *{XML::Atom::DATETIME} = sub() {0};
21             }
22            
23 0           local $^W = 0;
24             *XML::XPath::Function::namespace_uri = sub {
25 0           my $self = shift;
26 0           my($node, @params) = @_;
27 0           my $ns = $node->getNamespace($node->getPrefix);
28 0 0         if (!$ns) {
29 0           $ns = ($node->getNamespaces)[0];
30             }
31 0 0         XML::XPath::Literal->new($ns ? $ns->getExpanded : '');
32 0           };
33              
34 0           $XML::Atom::ForceUnicode = 0;
35 0           $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             ext_ent_handler => sub { warn "External entities disabled."; '' },
46             );
47             }
48              
49             sub expat_parser {
50             return XML::Parser->new(
51             Handlers => {
52             ExternEnt => sub { warn "External Entities disabled."; '' },
53             ExternEntFin => sub {},
54             },
55             );
56             }
57              
58             use base qw( XML::Atom::ErrorHandler Exporter );
59              
60             package XML::Atom::Namespace;
61             use strict;
62              
63             sub new {
64             my $class = shift;
65             my($prefix, $uri) = @_;
66             bless { prefix => $prefix, uri => $uri }, $class;
67             }
68              
69             sub DESTROY { }
70              
71             use vars qw( $AUTOLOAD );
72             sub AUTOLOAD {
73             (my $var = $AUTOLOAD) =~ s!.+::!!;
74             no strict 'refs';
75             ($_[0], $var);
76             }
77              
78             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