Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by veerubiji (Sexton)
on Nov 21, 2011 at 13:56 UTC ( #939200=note: print w/ replies, xml ) Need Help??


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

Hi I you mean sepcnode is not assigned, I can't overcome this error still please help what I have to do in my script.


Comment on Re^2: can't call method on an undefined error in perl script
Re^3: can't call method on an undefined error in perl script
by MidLifeXis (Prior) on Nov 21, 2011 at 14:13 UTC

    Who knows? We don't have the data you are trying to process. My guess is that the xpath pattern being searched for is not found in the document you are trying to process.

    --MidLifeXis

Re^3: can't call method on an undefined error in perl script
by Jenda (Abbot) on Nov 21, 2011 at 18:04 UTC

    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.

      Well, my( $foo ) = ...findnodes is list context

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

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (14)
As of 2014-12-22 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (132 votes), past polls