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.

In reply to XML lite unblessed reference by lfast

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.