r27486 - in /branches/upstream/libxml-rss-perl/current: ./ examples/2.0/ lib/XML/ lib/XML/RSS/Private/Output/ t/

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sun Nov 30 15:49:30 UTC 2008


Author: gregoa
Date: Sun Nov 30 15:49:24 2008
New Revision: 27486

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

Added:
    branches/upstream/libxml-rss-perl/current/examples/2.0/
    branches/upstream/libxml-rss-perl/current/examples/2.0/rss-2.0-sample-from-rssboard-multiple-skip-days-and-hours.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/TODO
    branches/upstream/libxml-rss-perl/current/lib/XML/RSS.pm
    branches/upstream/libxml-rss-perl/current/lib/XML/RSS/Private/Output/Base.pm
    branches/upstream/libxml-rss-perl/current/t/2.0-parse-2.t
    branches/upstream/libxml-rss-perl/current/t/test-generated-items.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=27486&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/Changes (original)
+++ branches/upstream/libxml-rss-perl/current/Changes Sun Nov 30 15:49:24 2008
@@ -1,4 +1,14 @@
 Revision history for Perl module XML::RSS
+    
+1.38 - November 27, 2008
+    - Added support for duplicate items of RSS modules.
+        - http://rt.cpan.org/Public/Bug/Display.html?id=4495
+    - Added support for multiple Dublin Core elements. One can point
+    the field to an array and it will create multiple elements:
+        - http://rt.cpan.org/Public/Bug/Display.html?id=6000
+    - Now parsing several <skipDays>/<day>s and <skipHours>/<hour>s into
+    an array reference instead of concatenating them together.
+        - http://rt.cpan.org/Public/Bug/Display.html?id=40978
 
 1.37 - November 18, 2008
     - Extracted the common parts of parse() and parsefile() into one

Modified: branches/upstream/libxml-rss-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/MANIFEST?rev=27486&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/MANIFEST (original)
+++ branches/upstream/libxml-rss-perl/current/MANIFEST Sun Nov 30 15:49:24 2008
@@ -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/rss-2.0-sample-from-rssboard-multiple-skip-days-and-hours.xml
 examples/convert.pl
 examples/create_rss_multiple.pl
 examples/README
@@ -72,7 +73,7 @@
 t/pod-coverage.t
 t/pod.t
 t/rss2-gt-encoding.t
+t/test-generated-items.t
 t/test_manifest
-t/test-generated-items.t
 t/version.t
 t/xml-header.t

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=27486&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/META.yml (original)
+++ branches/upstream/libxml-rss-perl/current/META.yml Sun Nov 30 15:49:24 2008
@@ -1,6 +1,6 @@
 ---
 name: XML-RSS
-version: 1.37
+version: 1.38
 author:
   - 'Original code: Jonathan Eisenzopf <eisen at pobox.com>'
   - |-
@@ -24,7 +24,7 @@
 provides:
   XML::RSS:
     file: lib/XML/RSS.pm
-    version: 1.37
+    version: 1.38
   XML::RSS::Private::Output::Base:
     file: lib/XML/RSS/Private/Output/Base.pm
   XML::RSS::Private::Output::Roles::ImageDims:

Modified: branches/upstream/libxml-rss-perl/current/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/TODO?rev=27486&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/TODO (original)
+++ branches/upstream/libxml-rss-perl/current/TODO Sun Nov 30 15:49:24 2008
@@ -1,10 +1,17 @@
 
 http://rt.cpan.org/Public/Dist/Display.html?Name=XML-RSS
 
+- Add a way (and an option) to parse module items with duplicate keys into
+an array reference.
+
+- Add a way (and an option) to parse multiple dc:items into an array reference:
+    - http://rt.cpan.org/Public/Bug/Display.html?id=6000
+
+- Convert an array of skipDays/day's or skipHours/hour's to multiple tags,
+when converting to text.
+    - http://rt.cpan.org/Public/Bug/Display.html?id=40978 
+
 --- before the next release-ish
-
-- Make sure the xml:base parsing into-hash-refs with an "xml:base" key
-is triggered only with a special option to parse.
 
 - wrong handling enclosure subelement of item
   http://rt.cpan.org/Ticket/Display.html?id=21740

Added: branches/upstream/libxml-rss-perl/current/examples/2.0/rss-2.0-sample-from-rssboard-multiple-skip-days-and-hours.xml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/examples/2.0/rss-2.0-sample-from-rssboard-multiple-skip-days-and-hours.xml?rev=27486&op=file
==============================================================================
--- branches/upstream/libxml-rss-perl/current/examples/2.0/rss-2.0-sample-from-rssboard-multiple-skip-days-and-hours.xml (added)
+++ branches/upstream/libxml-rss-perl/current/examples/2.0/rss-2.0-sample-from-rssboard-multiple-skip-days-and-hours.xml Sun Nov 30 15:49:24 2008
@@ -1,0 +1,71 @@
+<rss version="2.0">
+  <channel>
+    <description>Current headlines from the Dallas Times-Herald newspaper</description>
+    <link>http://dallas.example.com</link>
+    <title>Dallas Times-Herald</title>
+    <category>Media</category>
+    <category domain="Newspapers/Regional/United_States">Texas</category>
+    <cloud domain="server.example.com" path="/rpc" port="80" protocol="xml-rpc" registerProcedure="cloud.notify" />
+    <copyright>Copyright 2006 Dallas Times-Herald</copyright>
+    <docs>http://www.rssboard.org/rss-specification</docs>
+    <generator>Radio UserLand v8.2.1</generator>
+    <image>
+      <link>http://dallas.example.com</link>
+      <title>Dallas Times-Herald</title>
+      <url>http://dallas.example.com/masthead.gif</url>
+      <description>Read the Dallas Times-Herald</description>
+      <height>32</height>
+      <width>96</width>
+    </image>
+    <language>epo</language>
+    <lastBuildDate>Sun, 29 Jan 2006 17:17:44 GMT</lastBuildDate>
+    <managingEditor>jlehrer at dallas.example.com (Jim Lehrer)</managingEditor>
+    <pubDate>Sun, 29 Jan 2006 05:00:00 GMT</pubDate>
+    <rating>(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l by "webmaster at example.com" on "2006.01.29T10:09-0800" r (n 0 s 0 v 0 l 0))</rating>
+    <skipDays>
+      <day>Saturday</day>
+      <day>Sunday</day>
+    </skipDays>
+    <skipHours>
+      <hour>0</hour>
+      <hour>1</hour>
+      <hour>2</hour>
+      <hour>22</hour>
+      <hour>23</hour>
+    </skipHours>
+    <textInput>
+      <description>Your aggregator supports the textInput element. What software are you using?</description>
+      <link>http://www.cadenhead.org/textinput.php</link>
+      <name>query</name>
+      <title>TextInput Inquiry</title>
+    </textInput>
+    <ttl>60</ttl>
+    <webMaster>helpdesk at dallas.example.com</webMaster>
+    <item>
+      <title>Seventh Heaven! Ryan Hurls Another No Hitter</title>
+      <link>http://dallas.example.com/1991/05/02/nolan.htm</link>
+      <description>Texas Rangers pitcher Nolan Ryan hurled the seventh no-hitter of his legendary career on Arlington Appreciation Night, defeating the Toronto Blue Jays 3-0. The 44-year-old struck out 16 batters before a crowd of 33,439.</description>
+      <guid>http://dallas.example.com/1991/05/02/nolan.htm</guid>      
+    </item>
+    <item>
+      <author>jbb at dallas.example.com (Joe Bob Briggs)</author>
+      <category>rec.arts.movies.reviews</category>
+      <comments>http://dallas.example.com/feedback/1983/06/joebob.htm</comments>
+      <description>I'm headed for France. I wasn't gonna go this year, but then last week "Valley Girl" came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description>
+      <enclosure length="24986239" type="audio/mpeg" url="http://dallas.example.com/joebob_050689.mp3" />
+      <guid>http://dallas.example.com/1983/05/06/joebob.htm</guid>
+      <link>http://dallas.example.com/1983/05/06/joebob.htm</link>
+      <pubDate>Fri, 06 May 1983 09:00:00 CST</pubDate>
+      <source url="http://la.example.com/rss.xml">Los Angeles Herald-Examiner</source>
+      <title>Joe Bob Goes to the Drive-In</title>
+    </item>
+    <item>
+      <description>I'm headed for France. I wasn't gonna go this year, but then last week &lt;a href="http://www.imdb.com/title/tt0086525/"&gt;Valley Girl&lt;/a&gt; came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description>
+      <guid isPermaLink="false">tag:dallas.example.com,4131:news</guid>
+    </item>
+    <item>
+      <description><![CDATA[I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.]]></description>      
+      <guid isPermaLink="false">1983-05-06+lifestyle+joebob+2</guid>
+    </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=27486&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/lib/XML/RSS.pm (original)
+++ branches/upstream/libxml-rss-perl/current/lib/XML/RSS.pm Sun Nov 30 15:49:24 2008
@@ -17,7 +17,7 @@
 
 use vars qw($VERSION $AUTOLOAD @ISA $AUTO_ADD);
 
-$VERSION = '1.37';
+$VERSION = '1.38';
 
 $AUTO_ADD = 0;
 
@@ -685,11 +685,32 @@
     }
 
     $self->_append_text_to_elem_struct(
-        $self->{'items'}->[$self->{num_items} - 1],
+        $self->_last_item,
         $cdata,
         \&_return_item_elem,
     );
 }
+
+sub _append_to_array_elem {
+    my ($self, $category, $cdata) = @_;
+
+    if (! $self->_my_in_element($category))
+    {
+        return;
+    }
+
+    my $el = $self->_current_element;
+
+    if (ref($self->{$category}->{$el}) eq "ARRAY") {
+        $self->{$category}->{$el}->[-1] .= $cdata;
+    }
+    else {
+        $self->{$category}->{$el} .= $cdata;
+    }
+
+    return 1;
+}
+
 sub _handle_char {
     my ($self, $cdata) = (@_);
 
@@ -711,14 +732,11 @@
         $self->_append_text_to_elem("textinput", $cdata);
     }
     # skipHours element
-    elsif ($self->_my_in_element("skipHours")) {
-        $self->{'skipHours'}->{$self->_current_element} .= $cdata;
-
-    }
-    # skipDays element
-    elsif ($self->_my_in_element("skipDays")) {
-        $self->{'skipDays'}->{$self->_current_element} .= $cdata;
-
+    elsif ($self->_append_to_array_elem("skipHours", $cdata)) {
+        # Do nothing - already done in the predicate.
+    }
+    elsif ($self->_append_to_array_elem("skipDays", $cdata)) {
+        # Do nothing - already done in the predicate.
     }
     # channel element
     elsif ($self->_my_in_element("channel")) {
@@ -745,6 +763,34 @@
             && $hashref_ok_elements{$el}
         )
     );
+}
+
+sub _start_array_element {
+    my ($self, $cat, $el) = @_;
+
+    if (!$self->_my_in_element($cat)) {
+        return;
+    }
+
+    # If it's an array - append a new empty element because a new one
+    # was started.
+    if (ref($self->{$cat}->{$el}) eq "ARRAY") {
+        push @{$self->{$cat}->{$el}}, "";
+    }
+    # If it's not an array but still full (i.e: it's only the second
+    # element), then turn it into an array
+    elsif (defined($self->{$cat}->{$el}) && length($self->{$cat}->{$el})) {
+        $self->{$cat}->{$el} = [$self->{$cat}->{$el}, ""];
+    }
+    # Else - do nothing and let the function append to the new array.
+    
+    return 1;
+}
+
+sub _last_item {
+    my $self = shift;
+
+    return ($self->{'items'}->[$self->{num_items} - 1] ||= {});
 }
 
 sub _handle_start {
@@ -810,6 +856,13 @@
 
     # beginning of item element
     }
+    # TODO : Merge skipHours and skipDays
+    elsif ($self->_start_array_element("skipHours", $el)) {
+        # Do nothing - already done in the predicate.
+    }
+    elsif ($self->_start_array_element("skipDays", $el)) {
+        # Do nothing - already done in the predicate.
+    }
     elsif ($el eq 'item') {
 
         # deal with trouble makers who use mod_content :)
@@ -828,13 +881,13 @@
             }
         }
         # handle xml:base
-        $self->{'items'}->[$self->{num_items} - 1]->{'xml:base'} = $attribs{'base'} if exists $attribs{'base'};
+        $self->_last_item->{'xml:base'} = $attribs{'base'} if exists $attribs{'base'};
 
 
         # guid element is a permanent link unless isPermaLink attribute is set to false
     }
     elsif ($el eq 'guid') {
-        $self->{'items'}->[$self->{num_items} - 1]->{'isPermaLink'} =
+        $self->_last_item->{'isPermaLink'} =
           (exists($attribs{'isPermaLink'}) && 
               (lc($attribs{'isPermaLink'}) eq 'true')
           );
@@ -853,7 +906,7 @@
     {
 
         #print "taxo: ", $attribs{'resource'},"\n";
-        push(@{$self->{'items'}->[$self->{num_items} - 1]->{'taxo'}}, $attribs{'resource'});
+        push(@{$self->_last_item->{'taxo'}}, $attribs{'resource'});
         $self->{'modules'}->{'http://purl.org/rss/1.0/modules/taxonomy/'} = 'taxo';
 
         # beginning of taxo li in channel element
@@ -909,23 +962,23 @@
         # in the 'rdf_resource_fields' so this condition always evaluates
         # to false.
         # if ( $ns eq $self->{rss_namespace} ) {
-        #   $self->{'items'}->[$self->{num_items}-1]->{ $el } = $attribs{resource};
+        #   $self->_last_item->{ $el } = $attribs{resource};
         # }
         # else
         {
-            $self->{'items'}->[$self->{num_items} - 1]->{$ns}->{$el} = $attribs{resource};
+            $self->_last_item->{$ns}->{$el} = $attribs{resource};
 
             # add short cut
             #
             if (exists($self->{modules}->{$ns})) {
                 $ns = $self->{modules}->{$ns};
-                $self->{'items'}->[$self->{num_items} - 1]->{$ns}->{$el} = $attribs{resource};
+                $self->_last_item->{$ns}->{$el} = $attribs{resource};
             }
         }
     }
     elsif ($self->_should_be_hashref($el) and $self->_current_element eq 'item') {
         $attribs{'xml:base'} = delete $attribs{base} if defined $attribs{base};
-        $self->{items}->[$self->{num_items} - 1]->{$el} = \%attribs if keys %attribs;
+        $self->_last_item->{$el} = \%attribs if keys %attribs;
     }
 }
 
@@ -1579,6 +1632,20 @@
   dc:   http://purl.org/dc/elements/1.1/
   taxo: http://purl.org/rss/1.0/modules/taxonomy/
 
+The Dublin Core ('dc') hash keys may be point to an array
+reference, which in turn will specify multiple such keys, and render them
+one after the other. For example:
+
+    $rss->add_item (
+        title => $title,
+        link => $link,
+        dc => { 
+            subject=> ["Jungle", "Desert", "Swamp"],
+            creator=>$creator,
+            date=>$date
+        },
+    );
+
 Dublin Core elements may occur in channel, image, item(s), and textinput
 -- albeit uncomming to find them under image and textinput.  Syndication
 elements are limited to the channel element. Taxonomy elements can occur
@@ -1607,6 +1674,15 @@
 Then proceed as usual:
 
   $rss->add_item (title=>$title, link=>$link, my=>{ rating=>$rating });
+
+You can also set the value of the module's prefix to an array reference 
+of C<<< { el => , val => } >>> hash-references, in which case duplicate 
+elements are possible:
+
+  $rss->add_item(title=>$title, link=>$link, my=> [
+    {el => "rating", value => $rating1, }
+    {el => "rating", value => $rating2, },
+  ]
 
 Non-standard namespaces are not, however, currently accessible via a simple
 prefix; access them via their namespace URL like so:

Modified: branches/upstream/libxml-rss-perl/current/lib/XML/RSS/Private/Output/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/lib/XML/RSS/Private/Output/Base.pm?rev=27486&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/lib/XML/RSS/Private/Output/Base.pm (original)
+++ branches/upstream/libxml-rss-perl/current/lib/XML/RSS/Private/Output/Base.pm Sun Nov 30 15:49:24 2008
@@ -169,6 +169,22 @@
     return;
 }
 
+sub _out_array_tag {
+    my ($self, $tag, $inner) = @_;
+
+    if (ref($inner) eq "ARRAY") {
+        foreach my $elem (@$inner)
+        {
+            $self->_out_defined_tag($tag, $elem);
+        }
+    }
+    else {
+        $self->_out_defined_tag($tag, $inner);
+    }
+
+    return;
+}
+
 sub _out_inner_tag {
     my ($self, $params, $tag) = @_;
 
@@ -608,10 +624,95 @@
     foreach my $dc (@{$self->_get_dc_ok_fields()}) {
         next if $skip_hash->{$dc};
 
-        $self->_out_defined_tag("dc:$dc", $elem->{dc}->{$dc});
-    }
-
-    return;
+        $self->_out_array_tag("dc:$dc", $elem->{dc}->{$dc});
+    }
+
+    return;
+}
+
+sub _out_module_prefix_elements_hash
+{
+    my ($self, $args) = @_;
+
+    my $prefix = $args->{prefix};
+    my $data = $args->{data};
+    my $url = $args->{url};
+    
+    while (my ($el, $value) = each(%$data)) {
+        $self->_out_module_prefix_pair(
+            {
+                %$args,
+                el => $el,
+                val => $value,
+            }
+        );
+    }
+
+    return;
+}
+
+sub _out_module_prefix_pair
+{
+    my ($self, $args) = @_;
+
+    my $prefix = $args->{prefix};
+    my $url = $args->{url};
+    
+    my $el = $args->{el};
+    my $value = $args->{val};
+
+    if ($self->_main->_is_rdf_resource($el,$url)) {
+        $self->_out(
+            qq{<${prefix}:${el} rdf:resource="} . $self->_encode($value) . qq{" />\n});
+    }
+    else {
+        $self->_out_ns_tag($prefix, $el, $value);
+    }
+
+    return;
+}
+
+sub _out_module_prefix_elements_array
+{
+    my ($self, $args) = @_;
+
+    my $prefix = $args->{prefix};
+    my $data = $args->{data};
+    my $url = $args->{url};
+
+    foreach my $element (@$data)
+    {
+        $self->_out_module_prefix_pair(
+            {
+                %$args,
+                el => $element->{'el'},
+                val => $element->{'val'},
+            }
+        )
+    }
+
+    return;
+}
+
+sub _out_module_prefix_elements
+{
+    my ($self, $args) = @_;
+
+    my $data = $args->{'data'};
+
+    if (! $data) {
+        # Do nothing - empty data
+        return;
+    }
+    elsif (ref($data) eq "HASH") {
+        return $self->_out_module_prefix_elements_hash($args);
+    }
+    elsif (ref($data) eq "ARRAY") {
+        return $self->_out_module_prefix_elements_array($args);
+    }
+    else {
+        die "Don't know how to handle module data of type " . ref($data) . "!";
+    }
 }
 
 # Output the Ad-hoc modules
@@ -621,16 +722,15 @@
     # Ad-hoc modules
     while (my ($url, $prefix) = each %{$self->_modules}) {
         next if $prefix =~ /^(dc|syn|taxo)$/;
-        while (my ($el, $value) = each %{$super_elem->{$prefix} || {}}) {
-            if ($self->_main->_is_rdf_resource($el,$url))
+        
+        $self->_out_module_prefix_elements(
             {
-                $self->_out(
-                    qq{<${prefix}:${el} rdf:resource="} . $self->_encode($value) . qq{" />\n});
+                prefix => $prefix,
+                url => $url,
+                data => $super_elem->{$prefix},
             }
-            else {
-                $self->_out_ns_tag($prefix, $el, $value);
-            }
-        }
+        );
+
     }
 
     return;

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=27486&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 Sun Nov 30 15:49:24 2008
@@ -3,13 +3,15 @@
 use strict;
 use warnings;
 
-use Test::More tests => 2;
+use Test::More tests => 4;
 
 use XML::RSS;
+use File::Spec;
 
-my $rss = XML::RSS->new();
+{
+    my $rss = XML::RSS->new();
 
-$rss->parse(<<"EOF");
+    $rss->parse(<<"EOF");
 <?xml version="1.0" encoding="UTF-8" ?>
 <?xml-stylesheet href="/rss/news/journalism.xsl" type="text/xsl"?>
 <rss version="2.0">
@@ -40,12 +42,40 @@
 </rss>
 EOF
 
-# TEST
-is ($rss->{textinput}->{link}, "http://www.topix.net/search/", 
-    "Testing for textinput link"
-);
+    # TEST
+    is ($rss->{textinput}->{link}, "http://www.topix.net/search/", 
+        "Testing for textinput link"
+    );
 
-# TEST
-is ($rss->{channel}->{link}, "http://www.topix.net/news/journalism",
-    "Testing for channel link"
-);
+    # TEST
+    is ($rss->{channel}->{link}, "http://www.topix.net/news/journalism",
+        "Testing for channel link"
+    );
+}
+
+{
+    my $rss = XML::RSS->new();
+
+    $rss->parsefile(
+        File::Spec->catfile(
+            File::Spec->curdir(), 
+            "examples",
+            "2.0",
+            "rss-2.0-sample-from-rssboard-multiple-skip-days-and-hours.xml"
+        )
+    );
+
+    # TEST
+    is_deeply(
+        $rss->{'skipHours'}->{'hour'}, 
+        [qw(0 1 2 22 23)],
+        "skipHours/hour is parsed into an array with the individual elements",
+    );
+
+    # TEST
+    is_deeply(
+        $rss->{'skipDays'}->{'day'},
+        [qw(Saturday Sunday)],
+        "skipDays/day is parsed into an array with indiv elements",
+    );
+}

Modified: branches/upstream/libxml-rss-perl/current/t/test-generated-items.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-rss-perl/current/t/test-generated-items.t?rev=27486&op=diff
==============================================================================
--- branches/upstream/libxml-rss-perl/current/t/test-generated-items.t (original)
+++ branches/upstream/libxml-rss-perl/current/t/test-generated-items.t Sun Nov 30 15:49:24 2008
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 190;
+use Test::More tests => 192;
 
 use XML::RSS;
 use HTML::Entities qw(encode_entities);
@@ -4088,3 +4088,60 @@
         );
     }
 }
+
+{
+    my $rss = create_rss_1({
+        version => "1.0",
+        image_params => 
+        [
+            eloq =>
+            [
+                { 'el' => 'grow', 'val' => "There" },
+                { 'el' => 'grow', 'val' => "Position", },
+                { 'el' => 'show', 'val' => "and tell", },
+                { 'el' => 'show', 'val' => "must go on", },
+            ],
+        ],
+    });
+
+    $rss->add_module(prefix => "eloq", uri => "http://eloq.tld2/Gorj/");
+    # TEST
+    contains($rss, "<image rdf:about=\"0\">\n" .
+        "<title>freshmeat.net</title>\n" .
+        "<url>0</url>\n" .
+        "<link>http://freshmeat.net/</link>\n" .
+        "<eloq:grow>There</eloq:grow>\n" .
+        "<eloq:grow>Position</eloq:grow>\n" .
+        "<eloq:show>and tell</eloq:show>\n" .
+        "<eloq:show>must go on</eloq:show>\n" .
+        "</image>",
+        'Multiple values for the same key in a module, usign an array ref'
+    );
+}
+
+{
+    my $rss = create_channel_rss({
+        version => "1.0",
+    });
+
+    $rss->add_item(
+        title => "In the Dublin Core Jungle",
+        link => "http://jungle.tld/Enter/",
+        dc => {
+            subject => ['tiger', 'elephant', 'snake',],
+            language => "en-GB",
+        },
+    );
+
+    # TEST
+    contains($rss, "<item rdf:about=\"http://jungle.tld/Enter/\">\n" .
+        "<title>In the Dublin Core Jungle</title>\n" .
+        "<link>http://jungle.tld/Enter/</link>\n" .
+        "<dc:language>en-GB</dc:language>\n" .
+        "<dc:subject>tiger</dc:subject>\n" .
+        "<dc:subject>elephant</dc:subject>\n" .
+        "<dc:subject>snake</dc:subject>\n" .
+        "</item>\n",
+        "1.0 - item/multiple dc:subject's"
+    );
+}




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