r29310 - in /trunk/libxml-rss-perl: Changes MANIFEST META.yml debian/changelog examples/2.0/flickr-rss-with-both-desc-and-media-desc.xml lib/XML/RSS.pm t/2.0-parse-2.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Mon Jan 5 14:09:50 UTC 2009


Author: gregoa
Date: Mon Jan  5 14:09:47 2009
New Revision: 29310

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=29310
Log:
New upstream release.

Added:
    trunk/libxml-rss-perl/examples/2.0/flickr-rss-with-both-desc-and-media-desc.xml
      - copied unchanged from r29309, branches/upstream/libxml-rss-perl/current/examples/2.0/flickr-rss-with-both-desc-and-media-desc.xml
Modified:
    trunk/libxml-rss-perl/Changes
    trunk/libxml-rss-perl/MANIFEST
    trunk/libxml-rss-perl/META.yml
    trunk/libxml-rss-perl/debian/changelog
    trunk/libxml-rss-perl/lib/XML/RSS.pm
    trunk/libxml-rss-perl/t/2.0-parse-2.t

Modified: trunk/libxml-rss-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/Changes?rev=29310&op=diff
==============================================================================
--- trunk/libxml-rss-perl/Changes (original)
+++ trunk/libxml-rss-perl/Changes Mon Jan  5 14:09:47 2009
@@ -1,5 +1,10 @@
 Revision history for Perl module XML::RSS
  
+1.42 - January 3, 2008
+    - When transforming elements with attributes into hash-refs - make
+    sure they are placed in the correct namespace. Previously 
+    <media:description> over-rided the plain <description>. (as in Flickr).
+
 1.41 - December 4, 2008    
     - Made the default keys for the channel link, description and title undef 
     instead of ''. They become '' once they are opened.

Modified: trunk/libxml-rss-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/MANIFEST?rev=29310&op=diff
==============================================================================
--- trunk/libxml-rss-perl/MANIFEST (original)
+++ trunk/libxml-rss-perl/MANIFEST Mon Jan  5 14:09:47 2009
@@ -15,6 +15,7 @@
 examples/1.0/rss1.0.rdf
 examples/1.0/slash.rdf
 examples/1.0/update_rss_1.0.pl
+examples/2.0/flickr-rss-with-both-desc-and-media-desc.xml
 examples/2.0/rss-2.0-sample-from-rssboard-multiple-skip-days-and-hours.xml
 examples/convert.pl
 examples/create_rss_multiple.pl

Modified: trunk/libxml-rss-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/META.yml?rev=29310&op=diff
==============================================================================
--- trunk/libxml-rss-perl/META.yml (original)
+++ trunk/libxml-rss-perl/META.yml Mon Jan  5 14:09:47 2009
@@ -1,6 +1,6 @@
 ---
 name: XML-RSS
-version: 1.41
+version: 1.42
 author:
   - 'Original code: Jonathan Eisenzopf <eisen at pobox.com>'
   - |-
@@ -24,7 +24,7 @@
 provides:
   XML::RSS:
     file: lib/XML/RSS.pm
-    version: 1.41
+    version: 1.42
   XML::RSS::Private::Output::Base:
     file: lib/XML/RSS/Private/Output/Base.pm
   XML::RSS::Private::Output::Roles::ImageDims:
@@ -39,7 +39,7 @@
     file: lib/XML/RSS/Private/Output/V1_0.pm
   XML::RSS::Private::Output::V2_0:
     file: lib/XML/RSS/Private/Output/V2_0.pm
-generated_by: Module::Build version 0.3
+generated_by: Module::Build version 0.31
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.2.html
   version: 1.2

Modified: trunk/libxml-rss-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/debian/changelog?rev=29310&op=diff
==============================================================================
--- trunk/libxml-rss-perl/debian/changelog (original)
+++ trunk/libxml-rss-perl/debian/changelog Mon Jan  5 14:09:47 2009
@@ -1,3 +1,9 @@
+libxml-rss-perl (1.42-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org>  Mon, 05 Jan 2009 15:09:05 +0100
+
 libxml-rss-perl (1.41-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libxml-rss-perl/lib/XML/RSS.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/lib/XML/RSS.pm?rev=29310&op=diff
==============================================================================
--- trunk/libxml-rss-perl/lib/XML/RSS.pm (original)
+++ trunk/libxml-rss-perl/lib/XML/RSS.pm Mon Jan  5 14:09:47 2009
@@ -17,7 +17,7 @@
 
 use vars qw($VERSION $AUTOLOAD @ISA $AUTO_ADD);
 
-$VERSION = '1.41';
+$VERSION = '1.42';
 
 $AUTO_ADD = 0;
 
@@ -1116,8 +1116,23 @@
         }
     }
     elsif ($self->_should_be_hashref($el) and $self->_current_element eq 'item') {
-        $attribs{'xml:base'} = delete $attribs{base} if defined $attribs{base};
-        $self->_last_item->{$el} = \%attribs if keys %attribs;
+        if (defined $attribs{base}) {
+            $attribs{'xml:base'} = delete $attribs{base};
+        }
+        if (keys(%attribs)) {
+            if ($el_verdict) {
+                $self->_last_item->{$el} = \%attribs if keys %attribs;
+            }
+            else {
+                $self->_last_item->{$el_ns}->{$el} = \%attribs;
+
+                my $prefix = $self->{modules}->{$el_ns};
+
+                if ($prefix) {
+                    $self->_last_item->{$prefix}->{$el} = \%attribs;
+                }
+            }
+        }
     }
     elsif ($self->_start_array_element("image", $el)) {
         # Do nothing - already done in the predicate.
@@ -1225,6 +1240,8 @@
     return $self->{_parse_options};
 }
 
+sub _empty {}
+
 sub _generic_parse {
     my $self = shift;
     my $method = shift;
@@ -1241,7 +1258,28 @@
         $self->{modules} = +{%{$self->_get_default_modules()}, %{$self->{modules}}};
     }
 
-    $self->_get_parser()->$method($arg);
+    {
+        my $parser = $self->_get_parser();
+
+        eval {
+            $parser->$method($arg);
+        };
+
+        if ($@)
+        {
+            my $err = $@;
+
+            # Cleanup so perl-5.6.2 will be happy.
+            $parser->setHandlers(
+                map { ($_ => \&_empty) } (qw(Char XMLDecl Start End))
+            );
+            $self->_parser(0);
+
+            undef($parser);
+
+            die $err;
+        }
+    }
 
     $self->_auto_add_modules if $AUTO_ADD;
     $self->{version} = $self->{_internal}->{version};

Modified: trunk/libxml-rss-perl/t/2.0-parse-2.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/t/2.0-parse-2.t?rev=29310&op=diff
==============================================================================
--- trunk/libxml-rss-perl/t/2.0-parse-2.t (original)
+++ trunk/libxml-rss-perl/t/2.0-parse-2.t Mon Jan  5 14:09:47 2009
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 10;
+use Test::More tests => 13;
 
 use XML::RSS;
 use File::Spec;
@@ -138,7 +138,6 @@
     );
 }
 
-
 {
     my $rss = XML::RSS->new();
 
@@ -162,3 +161,37 @@
         "title is an empty string if an empty tasg",
     );
 }
+
+{
+    my $rss = XML::RSS->new();
+
+    $rss->parsefile(
+        File::Spec->catfile(
+            File::Spec->curdir(), 
+            qw(examples 2.0 flickr-rss-with-both-desc-and-media-desc.xml)
+        ),
+        { hashrefs_instead_of_strings => 1 },
+    );
+
+    # TEST
+    like ($rss->{'items'}->[0]->{'description'},
+        qr{\A\Q<p><a href="http://www.flickr.com/people/shlomif/"\E},
+        "Regular description and was not over-rided by media:description",
+    );
+
+    # TEST
+    like ($rss->{'items'}->[0]
+              ->{'http://search.yahoo.com/mrss/'}->{'description'}
+              ->{'content'},
+        qr{\A<p>No active bugs},
+        "media:desc content is OK.",
+    );
+
+    # TEST
+    is ($rss->{'items'}->[0]
+              ->{'http://search.yahoo.com/mrss/'}->{'description'}
+              ->{'type'},
+        "html",
+        "media:desc type is OK.",
+    );
+}




More information about the Pkg-perl-cvs-commits mailing list