Skip Menu |

This queue is for tickets about the XML-Atom-Syndication CPAN distribution.

Report information
The Basics
Id: 67253
Status: open
Priority: 0/
Queue: XML-Atom-Syndication

People
Owner: Nobody in particular
Requestors: dekimsey [...] ufl.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Entry/Feed do not support multiple element metadata
The RFC permits multiple category elements in an entry, link, contributors, etc, however the modules do not. From the looks of it, the accessor functions do not permit this functionality. o atom:feed elements MAY contain any number of atom:category elements. o atom:feed elements MAY contain any number of atom:contributor elements. o atom:feed elements MUST NOT contain more than one atom:generator element. o atom:feed elements MUST NOT contain more than one atom:icon element. o atom:feed elements MUST NOT contain more than one atom:logo element. o atom:feed elements MUST NOT contain more than one atom:link element with a rel attribute value of "alternate" that has the same combination of type and hreflang attribute values. o atom:feed elements MAY contain additional atom:link elements beyond those described above. o atom:feed elements MUST NOT contain more than one atom:rights element. o atom:feed elements MUST NOT contain more than one atom:subtitle element. This functionality would be greatly appreciated to properly support the RFC. Thanks!
From: dekimsey [...] ufl.edu
I made a patch (read: hack) to support multiple elements. It simply adds a foreach around the set_element's logic. It does not break any tests as of v0.942. However, I did not add any tests either. Hope this helps.
Subject: array_elements.patch
diff --git a/lib/XML/Atom/Syndication/Object.pm b/lib/XML/Atom/Syndication/Object.pm index a42b79e..53439ea 100644 --- a/lib/XML/Atom/Syndication/Object.pm +++ b/lib/XML/Atom/Syndication/Object.pm @@ -147,21 +147,23 @@ sub set_element { _remove($node) || return $atom->error($node->errstr); } } - if (my $class = ref $val) { - $val = $val->elem if $class =~ /^XML::Atom::Syndication::/; - $val->parent($atom->elem); - push @{$atom->elem->contents}, $val; - } elsif (defined $val) { - my $elem = XML::Elemental::Element->new; - $elem->name("{$ns_uri}$name"); - $elem->attributes($attr) if $attr; - $elem->parent($atom->elem); - push @{$atom->elem->contents}, $elem; - use XML::Elemental::Characters; - my $chars = XML::Elemental::Characters->new; - $chars->data($val); - $chars->parent($elem); - push @{$elem->contents}, $chars; + foreach $val ( ref $val eq 'ARRAY' ? @$val : $val ){ + if (my $class = ref $val) { + $val = $val->elem if $class =~ /^XML::Atom::Syndication::/; + $val->parent($atom->elem); + push @{$atom->elem->contents}, $val; + } elsif (defined $val) { + my $elem = XML::Elemental::Element->new; + $elem->name("{$ns_uri}$name"); + $elem->attributes($attr) if $attr; + $elem->parent($atom->elem); + push @{$atom->elem->contents}, $elem; + use XML::Elemental::Characters; + my $chars = XML::Elemental::Characters->new; + $chars->data($val); + $chars->parent($elem); + push @{$elem->contents}, $chars; + } } $val; }