Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 ( [id://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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: can't call method on an undefined error in perl script
by MidLifeXis (Monsignor) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://939200]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-19 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found