r9456 - in /branches/upstream/libxml-atom-perl/current: Changes META.yml Makefile.PL lib/XML/Atom.pm lib/XML/Atom/Base.pm lib/XML/Atom/Content.pm lib/XML/Atom/Thing.pm lib/XML/Atom/Util.pm t/19-ext.t t/27-client-leaks.t
hanska-guest at users.alioth.debian.org
hanska-guest at users.alioth.debian.org
Sat Nov 17 08:04:01 UTC 2007
Author: hanska-guest
Date: Sat Nov 17 08:04:01 2007
New Revision: 9456
URL: http://svn.debian.org/wsvn/?sc=1&rev=9456
Log:
[svn-upgrade] Integrating new upstream version, libxml-atom-perl (0.28)
Modified:
branches/upstream/libxml-atom-perl/current/Changes
branches/upstream/libxml-atom-perl/current/META.yml
branches/upstream/libxml-atom-perl/current/Makefile.PL
branches/upstream/libxml-atom-perl/current/lib/XML/Atom.pm
branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Base.pm
branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Content.pm
branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Thing.pm
branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Util.pm
branches/upstream/libxml-atom-perl/current/t/19-ext.t
branches/upstream/libxml-atom-perl/current/t/27-client-leaks.t
Modified: branches/upstream/libxml-atom-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-atom-perl/current/Changes?rev=9456&op=diff
==============================================================================
--- branches/upstream/libxml-atom-perl/current/Changes (original)
+++ branches/upstream/libxml-atom-perl/current/Changes Sat Nov 17 08:04:01 2007
@@ -1,6 +1,13 @@
$Id$
Revision history for XML::Atom
+
+0.28 2007.11.06
+ * Fixed Namespace handling in extensions so that both URL and NS object work
+ (Thanks to Brian Cassidy)
+
+0.27_01 2007.10.04
+ * Removes most of hacks to deal with LibXML insane unicode stuff which are fixed with 1.64
0.27 2007.09.15
* Fixed $feed->as_xml_utf8 to work with latest XML::LibXML
Modified: branches/upstream/libxml-atom-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-atom-perl/current/META.yml?rev=9456&op=diff
==============================================================================
--- branches/upstream/libxml-atom-perl/current/META.yml (original)
+++ branches/upstream/libxml-atom-perl/current/META.yml Sat Nov 17 08:04:01 2007
@@ -15,10 +15,10 @@
HTML::Parser: 0
LWP: 0
LWP::Authen::Wsse: 0
- XML::LibXML: 1.64
XML::XPath: 0
requires:
Class::Data::Inheritable: 0
MIME::Base64: 0
URI: 0
-version: 0.27
+ XML::LibXML: 1.64
+version: 0.28
Modified: branches/upstream/libxml-atom-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-atom-perl/current/Makefile.PL?rev=9456&op=diff
==============================================================================
--- branches/upstream/libxml-atom-perl/current/Makefile.PL (original)
+++ branches/upstream/libxml-atom-perl/current/Makefile.PL Sat Nov 17 08:04:01 2007
@@ -15,12 +15,9 @@
requires('MIME::Base64');
requires('URI');
requires('Class::Data::Inheritable');
+requires('XML::LibXML', 1.64);
features(
- 'Faster XML parsing with libxml' => [
- -default => 1,
- recommends('XML::LibXML' => 1.64),
- ],
'Pure perl XML parsing with XML::XPath' => [
-default => 0,
recommends('XML::XPath'),
Modified: branches/upstream/libxml-atom-perl/current/lib/XML/Atom.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-atom-perl/current/lib/XML/Atom.pm?rev=9456&op=diff
==============================================================================
--- branches/upstream/libxml-atom-perl/current/lib/XML/Atom.pm (original)
+++ branches/upstream/libxml-atom-perl/current/lib/XML/Atom.pm Sat Nov 17 08:04:01 2007
@@ -3,7 +3,7 @@
package XML::Atom;
use strict;
-our $VERSION = '0.27';
+our $VERSION = '0.28';
BEGIN {
@XML::Atom::EXPORT = qw( LIBXML );
Modified: branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Base.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Base.pm?rev=9456&op=diff
==============================================================================
--- branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Base.pm (original)
+++ branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Base.pm Sat Nov 17 08:04:01 2007
@@ -1,4 +1,4 @@
-# $Id: /mirror/code/XML-Atom/trunk/lib/XML/Atom/Base.pm 6911 2007-09-16T04:41:21.502409Z miyagawa $
+# $Id: /mirror/code/XML-Atom/trunk/lib/XML/Atom/Base.pm 8248 2007-11-06T21:05:44.685649Z miyagawa $
package XML::Atom::Base;
use strict;
@@ -6,7 +6,7 @@
use Encode;
use XML::Atom;
-use XML::Atom::Util qw( set_ns first nodelist childlist create_element remove_default_ns );
+use XML::Atom::Util qw( set_ns first nodelist childlist create_element );
__PACKAGE__->mk_classdata('__attributes', []);
@@ -168,7 +168,8 @@
sub get_object {
my $obj = shift;
my($ns, $name, $class) = @_;
- my @elem = childlist($obj->elem, $ns, $name) or return;
+ my $ns_uri = ref($ns) eq 'XML::Atom::Namespace' ? $ns->{uri} : $ns;
+ my @elem = childlist($obj->elem, $ns_uri, $name) or return;
my @obj = map { $class->new( Elem => $_, Namespace => $ns ) } @elem;
return wantarray ? @obj : $obj[0];
}
@@ -343,7 +344,6 @@
if (LIBXML) {
my $doc = XML::LibXML::Document->new('1.0', 'utf-8');
$doc->setDocumentElement($obj->elem);
- remove_default_ns($obj->elem);
return $doc->toString(1);
} else {
return '<?xml version="1.0" encoding="utf-8"?>' . "\n" .
Modified: branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Content.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Content.pm?rev=9456&op=diff
==============================================================================
--- branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Content.pm (original)
+++ branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Content.pm Sat Nov 17 08:04:01 2007
@@ -9,7 +9,6 @@
use Encode;
use XML::Atom;
-use XML::Atom::Util qw( remove_default_ns hack_unicode_entity );
use MIME::Base64 qw( encode_base64 decode_base64 );
sub element_name { 'content' }
@@ -112,14 +111,13 @@
}
$content->{__body} = '';
for my $n (@children) {
- remove_default_ns($n) if LIBXML;
$content->{__body} .= $n->toString(LIBXML ? 1 : 0);
}
} else {
$content->{__body} = LIBXML ? $elem->textContent : $elem->string_value;
}
if ($] >= 5.008) {
- $content->{__body} = hack_unicode_entity($content->{__body});
+ Encode::_utf8_off($content->{__body}) unless $XML::Atom::ForceUnicode;
}
} elsif ($mode eq 'base64') {
my $raw = decode_base64(LIBXML ? $elem->textContent : $elem->string_value);
Modified: branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Thing.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Thing.pm?rev=9456&op=diff
==============================================================================
--- branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Thing.pm (original)
+++ branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Thing.pm Sat Nov 17 08:04:01 2007
@@ -6,7 +6,7 @@
use XML::Atom;
use base qw( XML::Atom::ErrorHandler );
-use XML::Atom::Util qw( first nodelist childlist remove_default_ns create_element );
+use XML::Atom::Util qw( first nodelist childlist create_element );
use XML::Atom::Category;
use XML::Atom::Link;
use LWP::UserAgent;
Modified: branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Util.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Util.pm?rev=9456&op=diff
==============================================================================
--- branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Util.pm (original)
+++ branches/upstream/libxml-atom-perl/current/lib/XML/Atom/Util.pm Sat Nov 17 08:04:01 2007
@@ -7,7 +7,7 @@
use vars qw( @EXPORT_OK @ISA );
use Encode;
use Exporter;
- at EXPORT_OK = qw( set_ns hack_unicode_entity first nodelist childlist textValue iso2dt encode_xml remove_default_ns create_element );
+ at EXPORT_OK = qw( set_ns first nodelist childlist textValue iso2dt encode_xml create_element );
@ISA = qw( Exporter );
our %NS_MAP = (
@@ -35,14 +35,6 @@
sub ns_to_version {
my $ns = shift;
$NS_VERSION{$ns};
-}
-
-sub hack_unicode_entity {
- my $data = shift;
- Encode::_utf8_on($data);
- $data =~ s/&#x(\w{4});/chr(hex($1))/eg;
- Encode::_utf8_off($data) unless $XML::Atom::ForceUnicode;
- $data;
}
sub first {
@@ -114,19 +106,6 @@
$str;
}
-sub remove_default_ns {
- my($node) = @_;
- if (ref($node) =~ /Element$/ && $node->nodeName =~ /^default\d*:/) {
- my $ns = $node->getNamespace;
- if ($ns and my $uri = $ns->getData) {
- $node->setNamespace($uri, '');
- }
- }
- for my $n ($node->childNodes) {
- remove_default_ns($n);
- }
-}
-
sub create_element {
my($ns, $name) = @_;
my($ns_uri, $ns_prefix);
Modified: branches/upstream/libxml-atom-perl/current/t/19-ext.t
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-atom-perl/current/t/19-ext.t?rev=9456&op=diff
==============================================================================
--- branches/upstream/libxml-atom-perl/current/t/19-ext.t (original)
+++ branches/upstream/libxml-atom-perl/current/t/19-ext.t Sat Nov 17 08:04:01 2007
@@ -1,8 +1,8 @@
-# $Id: /mirror/code/XML-Atom/trunk/t/19-ext.t 6810 2007-06-20T19:20:38.705942Z miyagawa $
+# $Id: /mirror/code/XML-Atom/trunk/t/19-ext.t 8248 2007-11-06T21:05:44.685649Z miyagawa $
use strict;
use FindBin;
-use Test::More tests => 9;
+use Test::More tests => 16;
use XML::Atom::Feed;
@@ -27,6 +27,29 @@
like $feed->as_xml, qr/<foo xmlns="http:\/\/www.example.com\/ns\/">/;
+{
+ my $elem = XML::Atom::Ext::WithNS->new;
+ isa_ok $elem, 'XML::Atom::Ext::WithNS';
+ $elem->baz(1);
+ is $elem->baz, 1;
+ like $elem->as_xml, qr{<withns:with_ns.+xmlns:withns="http://example.com/withns/"};
+
+ $feed->add_with_ns( $elem );
+ like $feed->as_xml, qr{<withns:with_ns.+xmlns:withns="http://example.com/withns/"};
+}
+
+{
+ my $feed = XML::Atom::Feed->new( \'<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://purl.org/atom/ns#">
+ <withns:with_ns xmlns:withns="http://example.com/withns/" baz="1"/>
+</feed>' );
+
+ my( @elems ) = $feed->with_ns;
+ is scalar @elems, 1;
+ isa_ok $elems[ 0 ], 'XML::Atom::Ext::WithNS';
+ is $elems[ 0 ]->baz, 1 ;
+}
+
package XML::Atom::Ext::Foo;
use strict;
use base qw( XML::Atom::Base );
@@ -39,3 +62,23 @@
sub element_name { 'foo' }
sub element_ns { 'http://www.example.com/ns/' }
+
+
+package XML::Atom::Ext::WithNS;
+
+use strict;
+use warnings;
+
+use base qw( XML::Atom::Base );
+
+BEGIN {
+ __PACKAGE__->mk_attr_accessors( 'baz' );
+ XML::Atom::Feed->mk_object_list_accessor( with_ns => __PACKAGE__ );
+}
+
+sub element_name { return 'with_ns' }
+
+sub element_ns {
+ return XML::Atom::Namespace->new( "withns" => q{http://example.com/withns/} );
+}
+
Modified: branches/upstream/libxml-atom-perl/current/t/27-client-leaks.t
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-atom-perl/current/t/27-client-leaks.t?rev=9456&op=diff
==============================================================================
--- branches/upstream/libxml-atom-perl/current/t/27-client-leaks.t (original)
+++ branches/upstream/libxml-atom-perl/current/t/27-client-leaks.t Sat Nov 17 08:04:01 2007
@@ -1,7 +1,15 @@
use strict;
use warnings;
+use Test::More;
+
+BEGIN {
+ unless (eval { require DateTime }) {
+ plan skip_all => 'DateTime is required for tests';
+ }
+}
+
+plan tests => 1;
use XML::Atom::Client;
-use Test::More tests => 1;
my $foo;
no warnings 'redefine';
More information about the Pkg-perl-cvs-commits
mailing list