in reply to Re^2: can't call method on an undefined error in perl script
in thread can't call method on an undefined error in perl script

Who said anything about it being unassigned?!? It's undefined which means the findnodes() on line 11 returned an undef. The notoriously bad docs of XML::LibXML do not say anything about what's this method supposed to return if the XPath query doesn't match anything, but an undef is a quite way to return "nothing". Even though rereading the docs it seems it's supposed to return a XML::LibXML::NodeList object in scalar context no matter what.

Jenda
Enoch was right!
Enjoy the last years of Rome.

  • Comment on Re^3: can't call method on an undefined error in perl script

Replies are listed 'Best First'.
Re^4: can't call method on an undefined error in perl script
by Anonymous Monk on Nov 21, 2011 at 18:10 UTC
    Well, my( $foo ) = ...findnodes is list context

      Ahh ... good catch. You're right.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.