Subject: | $AUTO_ADD doesn't work as expected |
XML::RSS documentation says if you set $AUTO_ADD to 1, XML::RSS will automatically add_module() instead of you. It seems true, as it calls add_module() in parse() if $AUTO_ADD == 1, but it'd work as expected, when you use parse() method.
Think of content:encoded for example,
$XML::RSS::AUTO_ADD = 1;
my $rss = XML::RSS->new();
my $xml = get($url);
$rss->parse($xml);
print $rss->items->[0]->{content}->{encoded};
It doesn't return anything. As _auto_add_modules() is called *after* SUPER::parse(), reallocating namespaces to prefix in $rss's hash doesn't work. Thus, it'd work:
$XML::RSS::AUTO_ADD = 1;
$rss->parse($xml); # add_module()ed
$rss->parse($xml); # now correctly assigned to hash keys of prefix.
It's not a bug, but it can be very confusing to users.
Thanks,