File Coverage

blib/lib/XML/Atom.pm
Criterion Covered Total %
statement 32 40 80.0
branch 2 4 50.0
condition n/a
subroutine 10 15 66.6
pod 0 2 0.0
total 44 61 72.1


line stmt bran cond sub pod time code
1             # $Id$
2              
3             package XML::Atom;
4 23     23   4087 use strict;
  23         69  
  23         685  
5              
6 23     23   626 use 5.008_001;
  23         87  
7             our $VERSION = '0.43';
8              
9             BEGIN {
10 23     23   114 @XML::Atom::EXPORT = qw( LIBXML DATETIME);
11 23 50       54 if (eval { require XML::LibXML }) {
  23         16502  
12 23         1102304 *{XML::Atom::LIBXML} = sub() {1};
13             } else {
14 0         0 require XML::XPath;
15 0         0 *{XML::Atom::LIBXML} = sub() {0};
16             }
17 23 50       69 if (eval { require DateTime::Format::Atom }) {
  23         3988  
18 0         0 *{XML::Atom::DATETIME} = sub() {1};
19             } else {
20 23         120 *{XML::Atom::DATETIME} = sub() {0};
21             }
22              
23 23         90 $XML::Atom::ForceUnicode = 0;
24 23         3017 $XML::Atom::DefaultVersion = 0.3;
25             }
26              
27             sub libxml_parser {
28             ## uses old XML::LibXML < 1.70 interface for compat reasons
29             return XML::LibXML->new(
30             #no_network => 1, # v1.63+
31             expand_xinclude => 0,
32             expand_entities => 1,
33             load_ext_dtd => 0,
34 0     0   0 ext_ent_handler => sub { warn "External entities disabled."; '' },
  0         0  
35 34     34 0 284 );
36             }
37              
38             sub expat_parser {
39             return XML::Parser->new(
40             Handlers => {
41 0     0   0 ExternEnt => sub { warn "External Entities disabled."; '' },
  0         0  
42       0     ExternEntFin => sub {},
43             },
44 0     0 0 0 );
45             }
46              
47 23     23   163 use base qw( XML::Atom::ErrorHandler Exporter );
  23         47  
  23         7007  
48              
49             package XML::Atom::Namespace;
50 23     23   172 use strict;
  23         50  
  23         1924  
51              
52             sub new {
53 9     9   3805 my $class = shift;
54 9         25 my($prefix, $uri) = @_;
55 9         76 bless { prefix => $prefix, uri => $uri }, $class;
56             }
57              
58       0     sub DESTROY { }
59              
60 23     23   199 use vars qw( $AUTOLOAD );
  23         60  
  23         1999  
61             sub AUTOLOAD {
62 5     5   64 (my $var = $AUTOLOAD) =~ s!.+::!!;
63 23     23   173 no strict 'refs';
  23         45  
  23         1379  
64 5         29 ($_[0], $var);
65             }
66              
67             1;
68             __END__
69              
70             =head1 NAME
71              
72             XML::Atom - Atom feed and API implementation
73              
74             =head1 SYNOPSIS
75              
76             use XML::Atom;
77              
78             =head1 DESCRIPTION
79              
80             Atom is a syndication, API, and archiving format for weblogs and other
81             data. I<XML::Atom> implements the feed format as well as a client for the
82             API.
83              
84             =head1 LICENSE
85              
86             I<XML::Atom> is free software; you may redistribute it and/or modify it
87             under the same terms as Perl itself.
88              
89             =head1 AUTHOR
90              
91             Benjamin Trott, Tatsuhiko Miyagawa
92              
93             =head1 COPYRIGHT
94              
95             All rights reserved.
96              
97             =cut