Joseph
Joseph

Reputation: 23

Perl XML::LibXML returning different results on different systems

I have a Linux Mint 17 system running perl v5.18.2, with a simple script to fetch some XML:

use XML::LibXML;

$url='http://forecast.weather.gov/MapClick.php?lat=39.82390&lon=-97.64500&unit=0&lg=english&FcstType=dwml';

$parser = XML::LibXML->new();

$docFetched = $parser->parse_file($url);

print $docFetched;

It returns a full page of XML, which is what I want.

However, when I run this same script on another system (CentOS 6.4) with perl v5.10.1, I get the following:

XML::LibXML::Document=SCALAR(0x1253e40)

What might be the problem?

Any help would be great.

Thanks!

Upvotes: 0

Views: 65

Answers (1)

tobyink
tobyink

Reputation: 13664

Recent versions of XML::LibXML overload stringification; older versions do not.

Upgrade XML::LibXML on your CentOS machine, or else, just call $docFetched->toString to get back a string of XML.

Upvotes: 2

Related Questions