Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Script stopped working...

by hippo (Chancellor)
on Mar 18, 2018 at 08:20 UTC ( #1211178=note: print w/replies, xml ) Need Help??


in reply to Script stopped working...

$content = $ua->request($req); my $data = $xml->XMLin($content);

This is a bug. $content in this context is an HTTP::Response object, not something which can be blindly passed to XMLin() successfully. You first need to extract the XML from it. eg. by using decoded_content. I'd therefore refrain from calling the response $content in the first place.

Try replacing those two lines with:

my $response = $ua->request ($req); my $content = $response->decoded_content; my $data = $xml->XMLin ($content);

That ought to get you a little bit farther along at least.

Replies are listed 'Best First'.
Re^2: Script stopped working...
by gentoobob (Novice) on Mar 18, 2018 at 17:20 UTC

    Yep! Wow. I figured I was missing some kind of decoding which is why I was trying to mess around with Data::Dumper but I couldn't get anywhere with it. This works! Thank you so much. Ive been trying to fix this script for 2 weeks now and putting serious time into. Thank you again.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1211178]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2020-11-27 21:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?