Subject: | returns HASH for empty field |
In an Atom 10 feed, someone forgot to fill-in the title. Now a HASH gets returned for "$item->title" where it should have been either an empty string or undef.
Details: $item->title calls get_value() with
$VAR1 = {
'-type' => 'text'
};
The "#text" key missing. In case of a HASH (this case), _fetch_value() gets called. When this does not find '#text', it leaves the sub with returning the whole HASH.
Suggested patch:
--- lib/XML/FeedPP.pm
+++ libXML/FeedPP.pm.new
@@ -2331,6 +2331,7 @@ sub _fetch_value {
if ( exists $value->{'#text'} ) {
return $self->_fetch_value($value->{'#text'})
}
+ return undef;
} elsif ( UNIVERSAL::isa( $value, 'SCALAR' )) {
# CDATA section as a scalar reference
return $$value;