Subject: | Confused argument handling in parse methods |
Hi there.
I wasn't able to get any output from using the parse_file method, and it
returned undef instead of producing any error message. The docs specify
it to be called like this:
my $feed = $p->parse_file($fh);
which is what I did. But looking at the source, I can see the following:
sub parse { _parse('parse', @_); }
sub parse_file { _parse('parse_file', @_); }
sub parse_string { _parse('parse_string', @_); }
sub parse_uri { _parse('parse_uri', @_); }
sub _parse {
my $meth = shift;
my $e = shift;
my $doc;
eval { $doc = $e->{__parser}->$meth(@_) };
return $e->error($@) if ($@);
$e->rss_normalize($doc);
}
$e doesn't look like it's expected to be a filehandle. As new() includes
the following line,
$self->{__parser} = XML::Elemental->parser($params);
that would imply that the "$e" object is actually the parser itself. I
think there's an object/functional style mismatch happening.
Thanks,
Earle.