Re: newbie help for podcast script [with attach]

2005-07-31 Thread alexeijh
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]
 




Re: newbie help for podcast script [with attach]

2005-07-30 Thread alexeijh
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?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




newbie help for podcast script [with attach]

2005-07-29 Thread alexeijh
*** SORRY, forgot to attach file. ***

Hi,

This is basically my 1st perl script.

It's a podcast download app. I don't now the etiquette for attaching
files, but I have attached a <100 line perl file.

It seems that it fails if there is only 1 podcast for a feed with:

fetching http://www.abc.net.au/science/k2/podcast/drk_rss.xml ...

Odd number of elements in anonymous hash
at /home/lexhider/bin/GodCast.pl line 65.
fileparse(): need a valid pathname at /home/lexhider/bin/GodCast.pl line
68

I'd really appreciate:
A) Help with this problem.
B) Any tips on the code as a whole.

Lex.



GodCast.pl
Description: Perl program
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


newbie help for podcast script

2005-07-29 Thread alexeijh
Hi,

This is basically my 1st perl script.

It's a podcast download app. I don't now the etiquette for attaching
files, but I have attached a <100 line perl file.

It seems that it fails if there is only 1 podcast for a feed with:

fetching http://www.abc.net.au/science/k2/podcast/drk_rss.xml ...

Odd number of elements in anonymous hash
at /home/lexhider/bin/GodCast.pl line 65.
fileparse(): need a valid pathname at /home/lexhider/bin/GodCast.pl line
68

I'd really appreciate:
A) Help with this problem.
B) Any tips on the code as a whole.

Lex.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]