r29308 - in /branches/upstream/libxml-rss-perl/current: Changes MANIFEST META.yml 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:08:24 UTC 2009


Author: gregoa
Date: Mon Jan  5 14:08:14 2009
New Revision: 29308

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=29308
Log:
[svn-upgrade] Integrating new upstream version, libxml-rss-perl (1.42)

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

Modified: branches/upstream/libxml-rss-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/Changes?rev=29308&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/Changes (original)
+++ branches/upstream/libxml-rss-perl/current/Changes Mon Jan  5 14:08:14 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: branches/upstream/libxml-rss-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/MANIFEST?rev=29308&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/MANIFEST (original)
+++ branches/upstream/libxml-rss-perl/current/MANIFEST Mon Jan  5 14:08:14 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: branches/upstream/libxml-rss-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/META.yml?rev=29308&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/META.yml (original)
+++ branches/upstream/libxml-rss-perl/current/META.yml Mon Jan  5 14:08:14 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

Added: branches/upstream/libxml-rss-perl/current/examples/2.0/flickr-rss-with-both-desc-and-media-desc.xml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/examples/2.0/flickr-rss-with-both-desc-and-media-desc.xml?rev=29308&op=file
==============================================================================
--- branches/upstream/libxml-rss-perl/current/examples/2.0/flickr-rss-with-both-desc-and-media-desc.xml (added)
+++ branches/upstream/libxml-rss-perl/current/examples/2.0/flickr-rss-with-both-desc-and-media-desc.xml Mon Jan  5 14:08:14 2009
@@ -1,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<rss version="2.0"
+        xmlns:media="http://search.yahoo.com/mrss/"
+	    xmlns:dc="http://purl.org/dc/elements/1.1/"
+	    	    xmlns:flickr="urn:flickr:" >
+	<channel>
+
+
+		<title>Uploads from shlomif2</title>
+		<link>http://www.flickr.com/photos/shlomif/</link>
+ 		<description></description>
+		<pubDate>Thu, 4 Dec 2008 03:02:12 -0800</pubDate>
+		<lastBuildDate>Thu, 4 Dec 2008 03:02:12 -0800</lastBuildDate>
+		<generator>http://www.flickr.com/</generator>
+		<image>
+			<url>http://farm1.static.flickr.com/79/buddyicons/81969889@N00.jpg?1158015125#81969889@N00</url>
+			<title>Uploads from shlomif2</title>
+			<link>http://www.flickr.com/photos/shlomif/</link>
+		</image>
+
+		<item>
+			<title>Zarro Bugs</title>
+			<link>http://www.flickr.com/photos/shlomif/3081446735/</link>
+			<description>&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/shlomif/&quot;&gt;shlomif2&lt;/a&gt; posted a photo:&lt;/p&gt;
+&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/shlomif/3081446735/&quot; title=&quot;Zarro Bugs&quot;&gt;&lt;img src=&quot;http://farm4.static.flickr.com/3043/3081446735_b4d7492611_m.jpg&quot; width=&quot;240&quot; height=&quot;193&quot; alt=&quot;Zarro Bugs&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;No active bugs in perl-XML-RSS-1.41! Let's see how long it will last…&lt;/p&gt;</description>
+			<pubDate>Thu, 4 Dec 2008 03:02:12 -0800</pubDate>
+			                        <dc:date.Taken>2008-12-04T13:02:12-08:00</dc:date.Taken>
+            			<author flickr:profile="http://www.flickr.com/people/shlomif/">nobody at flickr.com (shlomif2)</author>
+			<guid isPermaLink="false">tag:flickr.com,2004:/photo/3081446735</guid>
+                            			<media:content url="http://farm4.static.flickr.com/3043/3081446735_6ea84a6e37_o.png" 
+				       type="image/jpeg"
+				       height="859"
+				       width="1066"/>
+            <media:title>Zarro Bugs</media:title>
+        <media:description type="html">&lt;p&gt;No active bugs in perl-XML-RSS-1.41! Let's see how long it will last…&lt;/p&gt;</media:description>
+        <media:thumbnail url="http://farm4.static.flickr.com/3043/3081446735_b4d7492611_s.jpg" height="75" width="75" />
+        <media:credit role="photographer">shlomif2</media:credit>
+		<media:category scheme="urn:flickr:tags">screenshot firefox rss landmark bugs xml zero milestone perl zarro</media:category>
+
+
+		</item>
+		<item>
+			<title>Cupcakes</title>
+			<link>http://www.flickr.com/photos/shlomif/3059592974/</link>
+			<description>&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/people/shlomif/&quot;&gt;shlomif2&lt;/a&gt; posted a photo:&lt;/p&gt;
+&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/shlomif/3059592974/&quot; title=&quot;Cupcakes&quot;&gt;&lt;img src=&quot;http://farm4.static.flickr.com/3272/3059592974_4d79fde160_m.jpg&quot; width=&quot;240&quot; height=&quot;180&quot; alt=&quot;Cupcakes&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;Photographs of cupcakes that my sister prepared.&lt;br /&gt;
+&lt;br /&gt;
+The licence is Creative Commons Public Domain, but an attribution or donation would be appreciated.&lt;/p&gt;</description>
+			<pubDate>Tue, 25 Nov 2008 11:11:58 -0800</pubDate>
+			                        <dc:date.Taken>2008-11-23T15:04:42-08:00</dc:date.Taken>
+            			<author flickr:profile="http://www.flickr.com/people/shlomif/">nobody at flickr.com (shlomif2)</author>
+			<guid isPermaLink="false">tag:flickr.com,2004:/photo/3059592974</guid>
+                            			<media:content url="http://farm4.static.flickr.com/3272/3059592974_ec763dd5c7_o.jpg" 
+				       type="image/jpeg"
+				       height="2304"
+				       width="3072"/>
+            <media:title>Cupcakes</media:title>
+        <media:description type="html">&lt;p&gt;Photographs of cupcakes that my sister prepared.&lt;br /&gt;
+&lt;br /&gt;
+The licence is Creative Commons Public Domain, but an attribution or donation would be appreciated.&lt;/p&gt;</media:description>
+        <media:thumbnail url="http://farm4.static.flickr.com/3272/3059592974_4d79fde160_s.jpg" height="75" width="75" />
+        <media:credit role="photographer">shlomif2</media:credit>
+		<media:category scheme="urn:flickr:tags">food hearts muffins cupcakes baking sweet sister sugar cupcake bakery muffin</media:category>
+
+
+		</item>
+	</channel>
+</rss>

Modified: branches/upstream/libxml-rss-perl/current/lib/XML/RSS.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/lib/XML/RSS.pm?rev=29308&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/lib/XML/RSS.pm (original)
+++ branches/upstream/libxml-rss-perl/current/lib/XML/RSS.pm Mon Jan  5 14:08:14 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: branches/upstream/libxml-rss-perl/current/t/2.0-parse-2.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/t/2.0-parse-2.t?rev=29308&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/t/2.0-parse-2.t (original)
+++ branches/upstream/libxml-rss-perl/current/t/2.0-parse-2.t Mon Jan  5 14:08:14 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