On Sat, 2005-07-30 at 20:15 +1000, [EMAIL PROTECTED] wrote:
> On Fri, 2005-07-29 at 19:03 -0700, John W. Krahn wrote:
> 
> > You are trying to call the get() method on the $feed object.  Read the
> > documentation for the correct syntax for XML::Simple::XMLin().
> > 
> > perldoc XML::Simple
> > 
> > 
> > As to the warning message:
> > 
> > perldoc perldiag
> > [snip]
> >        Odd number of elements in anonymous hash
> >            (W misc) You specified an odd number of elements to
> >            initialize a hash, which is odd, because hashes come in
> >            key/value pairs.
> > 
> > So your $data variable is not being assigned a valid anonymous hash
> > probably because you are using XML::Simple::XMLin() incorrectly.
> > 
> 
> Thanks for the advice.
> I'm not sure that that is the issue. 
> 
> I experimented with 1st downloading the file and using XMLin('foo.xml')
> and the behaviour was the same.
> 
> The script works fine for a normal pod feed. It only fails when the feed
> only has one channel->item.
> 
> Is line 65 OK?
> 
> "foreach my $item (@{$data->{channel}->{item}}) {"
> 
> all I want to do is step through one-by-one each item. Does that code
> work properly if there is only one item instead of many?

OK, the answer to the above question is no, if there is only one item in
the xml file, then the Perl script will fail at this point:

Not an ARRAY reference at ./foo.pl line XX.

Any tips on the correct way to do what I am attempting.

> 
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to