r32612 - in /trunk/libxml-rss-perl: Changes MANIFEST META.yml debian/changelog debian/control lib/XML/RSS.pm lib/XML/RSS/Private/Output/Base.pm t/enclosures-multi.t t/test_manifest t/xml-base.t

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Sat Apr 4 04:02:05 UTC 2009


Author: ryan52-guest
Date: Sat Apr  4 04:02:00 2009
New Revision: 32612

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=32612
Log:
* New upstream release
* Add myself to Uploaders

Added:
    trunk/libxml-rss-perl/t/enclosures-multi.t
      - copied unchanged from r32611, branches/upstream/libxml-rss-perl/current/t/enclosures-multi.t
    trunk/libxml-rss-perl/t/xml-base.t
      - copied unchanged from r32611, branches/upstream/libxml-rss-perl/current/t/xml-base.t
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/debian/control
    trunk/libxml-rss-perl/lib/XML/RSS.pm
    trunk/libxml-rss-perl/lib/XML/RSS/Private/Output/Base.pm
    trunk/libxml-rss-perl/t/test_manifest

Modified: trunk/libxml-rss-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/Changes?rev=32612&op=diff
==============================================================================
--- trunk/libxml-rss-perl/Changes (original)
+++ trunk/libxml-rss-perl/Changes Sat Apr  4 04:02:00 2009
@@ -1,4 +1,10 @@
 Revision history for Perl module XML::RSS
+
+1.44 - April 1, 2009
+    - Applied a patch from Simon Wistow (after some modifications) to
+    add support for multiple enclosures.
+    - Added the t/xml-base.t test file from Simon Wistow to test for
+    xml:base. Corrected for style.
 
 1.43 - January 12, 2009
     - Fixed the date on the last entry on this changelog, to say "2009"

Modified: trunk/libxml-rss-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/MANIFEST?rev=32612&op=diff
==============================================================================
--- trunk/libxml-rss-perl/MANIFEST (original)
+++ trunk/libxml-rss-perl/MANIFEST Sat Apr  4 04:02:00 2009
@@ -65,6 +65,7 @@
 t/data/merlyn1.rss
 t/data/rss-permalink.xml
 t/enclosures2.t
+t/enclosures-multi.t
 t/enclosures.t
 t/encode-output.t
 t/encoding.t
@@ -80,4 +81,5 @@
 t/test-generated-items.t
 t/test_manifest
 t/version.t
+t/xml-base.t
 t/xml-header.t

Modified: trunk/libxml-rss-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/META.yml?rev=32612&op=diff
==============================================================================
--- trunk/libxml-rss-perl/META.yml (original)
+++ trunk/libxml-rss-perl/META.yml Sat Apr  4 04:02:00 2009
@@ -1,6 +1,6 @@
 ---
 name: XML-RSS
-version: 1.43
+version: 1.44
 author:
   - 'Original code: Jonathan Eisenzopf <eisen at pobox.com>'
   - |-
@@ -24,7 +24,7 @@
 provides:
   XML::RSS:
     file: lib/XML/RSS.pm
-    version: 1.43
+    version: 1.44
   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.31
+generated_by: Module::Build version 0.32
 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=32612&op=diff
==============================================================================
--- trunk/libxml-rss-perl/debian/changelog (original)
+++ trunk/libxml-rss-perl/debian/changelog Sat Apr  4 04:02:00 2009
@@ -1,10 +1,15 @@
-libxml-rss-perl (1.43-1) UNRELEASED; urgency=low
-
+libxml-rss-perl (1.44-1) UNRELEASED; urgency=low
+
+  [ Brian Cassidy ]
   NOTICE: No need to upload as the upstream release had no significant changes
 
   * New upstream release
 
- -- Brian Cassidy <brian.cassidy at gmail.com>  Thu, 15 Jan 2009 11:20:10 -0400
+  [ Ryan Niebur ]
+  * New upstream release
+  * Add myself to Uploaders
+
+ -- Ryan Niebur <ryanryan52 at gmail.com>  Fri, 03 Apr 2009 21:01:55 -0700
 
 libxml-rss-perl (1.42-1) unstable; urgency=low
 

Modified: trunk/libxml-rss-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/debian/control?rev=32612&op=diff
==============================================================================
--- trunk/libxml-rss-perl/debian/control (original)
+++ trunk/libxml-rss-perl/debian/control Sat Apr  4 04:02:00 2009
@@ -5,7 +5,7 @@
 Uploaders: Jay Bonci <jaybonci at debian.org>,
  Brian Cassidy <brian.cassidy at gmail.com>,
  Vincent Danjean <vdanjean at debian.org>, Damyan Ivanov <dmn at debian.org>,
- gregor herrmann <gregoa at debian.org>, Gunnar Wolf <gwolf at debian.org>
+ gregor herrmann <gregoa at debian.org>, Gunnar Wolf <gwolf at debian.org>, Ryan Niebur <ryanryan52 at gmail.com>
 Standards-Version: 3.8.0
 Build-Depends: debhelper (>= 7)
 Build-Depends-Indep: perl, libtest-manifest-perl (>= 0.9), libtest-simple-perl,

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=32612&op=diff
==============================================================================
--- trunk/libxml-rss-perl/lib/XML/RSS.pm (original)
+++ trunk/libxml-rss-perl/lib/XML/RSS.pm Sat Apr  4 04:02:00 2009
@@ -17,7 +17,7 @@
 
 use vars qw($VERSION $AUTOLOAD @ISA $AUTO_ADD);
 
-$VERSION = '1.43';
+$VERSION = '1.44';
 
 $AUTO_ADD = 0;
 
@@ -329,6 +329,8 @@
     # initialize items
     $self->{items} = [];
 
+    delete $self->{_allow_multiple};
+
     my $ok_fields = $self->_get_ok_fields();
 
     my $ver_ok_fields =
@@ -1121,15 +1123,18 @@
         }
         if (keys(%attribs)) {
             if ($el_verdict) {
-                $self->_last_item->{$el} = \%attribs if keys %attribs;
+                $self->_last_item->{$el} =
+                  $self->_make_array($el, $self->_last_item->{$el}, \%attribs);
             }
             else {
-                $self->_last_item->{$el_ns}->{$el} = \%attribs;
+                $self->_last_item->{$el_ns}->{$el} =
+                  $self->_make_array($el, $self->_last_item->{$el_ns}->{$el}, \%attribs);
 
                 my $prefix = $self->{modules}->{$el_ns};
 
                 if ($prefix) {
-                    $self->_last_item->{$prefix}->{$el} = \%attribs;
+                    $self->_last_item->{$prefix}->{$el} =
+                      $self->_make_array($el, $self->_last_item->{$prefix}->{$el}, \%attribs);
                 }
             }
         }
@@ -1153,6 +1158,38 @@
             $self->{'channel'}->{$el} = "";
         }
     }
+}
+
+sub _make_array {
+    my $self = shift;
+    my $el   = shift;
+    my $old  = shift;
+    my $new  = shift;
+
+    if (!$self->_allow_multiple($el)) {
+      return $new;
+    }
+
+    if (!defined $old) {
+        $old = [];
+    } elsif (ref($old) ne 'ARRAY') {
+        $old = [$old];
+    }
+    push @$old, $new;
+    return $old;
+}
+
+sub _allow_multiple {
+    my $self = shift;
+    my $el   = shift;
+
+    $self->{_allow_multiple} ||=
+        {
+            map { $_ => 1 }
+            @{$self->_parse_options->{allow_multiple} || []}
+        };
+
+    return $self->{_allow_multiple}->{$el};
 }
 
 sub _handle_end {
@@ -1738,6 +1775,14 @@
 
 =over 4
 
+=item * allow_multiple
+
+Takes an array ref of names which indicates which elements should
+be allowed to have multiple occurrences. So, for example, to parse
+feeds with multiple enclosures
+
+   $rss->parse($xml, { allow_multiple => ['enclosure'] });
+
 =item * hashrefs_instead_of_strings
 
 If true, then some items (so far "C<description>") will become hash-references

Modified: trunk/libxml-rss-perl/lib/XML/RSS/Private/Output/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/lib/XML/RSS/Private/Output/Base.pm?rev=32612&op=diff
==============================================================================
--- trunk/libxml-rss-perl/lib/XML/RSS/Private/Output/Base.pm (original)
+++ trunk/libxml-rss-perl/lib/XML/RSS/Private/Output/Base.pm Sat Apr  4 04:02:00 2009
@@ -934,7 +934,7 @@
 
 sub _out_item_source {
     my ($self, $item) = @_;
-    
+
     if (defined $item->{source} && defined $item->{sourceUrl}) {
         $self->_out('<source url="'
           . $self->_encode($item->{sourceUrl}) . '">'
@@ -943,17 +943,29 @@
     }
 }
 
-sub _out_item_enclosure {
-    my ($self, $item) = @_;
-
-    if (my $e = $item->{enclosure}) {
+sub _out_single_item_enclosure {
+    my ($self, $item, $enc) = @_;
+
+    return
         $self->_out(
             "<enclosure " .
-            join(' ', 
-                map { "$_=\"" . $self->_encode($e->{$_}) . '"' } keys(%$e)
+            join(' ',
+                map { "$_=\"" . $self->_encode($enc->{$_}) . '"' } keys(%$enc)
             ) .
             " />\n"
         );
+}
+
+sub _out_item_enclosure {
+    my ($self, $item) = @_;
+
+    if (my $enc = $item->{enclosure}) {
+        foreach my $sub (
+            (ref($enc) eq "ARRAY") ? @$enc : ($enc)
+        )
+        {
+            $self->_out_single_item_enclosure($item, $sub)
+        }
     }
 }
 

Modified: trunk/libxml-rss-perl/t/test_manifest
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libxml-rss-perl/t/test_manifest?rev=32612&op=diff
==============================================================================
--- trunk/libxml-rss-perl/t/test_manifest (original)
+++ trunk/libxml-rss-perl/t/test_manifest Sat Apr  4 04:02:00 2009
@@ -22,6 +22,7 @@
 auto_add_modules.t
 enclosures.t
 enclosures2.t
+enclosures-multi.t
 encode-output.t
 test-generated-items.t
 pod-coverage.t
@@ -30,3 +31,4 @@
 xml-header.t
 add-item-insert-vs-append.t
 guid.t
+xml-base.t




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