Hi Monks,
Does anyone have a guess why this code
generates an unblessed reference error?
Code and output below.
The output of Data::Dump seems to
show that $nodes is blessed
however I get the unblessed error at the
end of the listing.
Thanks,
Larry
# Test XML::DOM::Lite
use strict "vars";
use strict "subs";
use XML::DOM::Lite qw(Parser :constants XPath);
use XML::DOM::Lite::NodeList;
use XML::Dumper;
use Data::Dumper;
my $xml = q|
<perldata>
<hello>
</hello>
</perldata>
|;
my $doc = Parser->parse($xml);
my $nodes = $doc->selectNodes('/perldata/hello');
$Data::Dumper::Maxdepth=3;
print Data::Dumper->Dump($nodes);
my $len = $nodes->length;
--------------------------------
node dump
$VAR1 = bless( {
'nodeType' => 1,
'childNodes' => bless( [
'XML::DOM::Lite::Node=HASH(0x1f43be4)'
], 'XML::DOM::Lite::NodeList' ),
'ownerDocument' => bless( {
'nodeType' => 9,
'elements' => 'HASH(0x1f432a4)',
'childNodes' => 'XML::DOM::Lite::NodeList=ARRAY(0x1f434d4)',
'nodeName' => '#document',
'documentElement' => 'XML::DOM::Lite::Node=HASH(0x1f439e4)',
'attributes' => 'XML::DOM::Lite::NodeList=ARRAY(0x1f43524)'
}, 'XML::DOM::Lite::Document' ),
'nodeName' => 'hello',
'attributes' => bless( [], 'XML::DOM::Lite::NodeList' ),
'parentNode' => $VAR1->{'ownerDocument'}{'documentElement'},
'tagName' => 'hello'
}, 'XML::DOM::Lite::Node' );
Can't call method "length" on unblessed reference at test.pl line 26.