Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Mojo::DOM exception handling help

by davido (Cardinal)
on Aug 01, 2020 at 19:35 UTC ( #11120210=note: print w/replies, xml ) Need Help??


in reply to Mojo::DOM exception handling help

This doesn't do anything useful:

'div.abstract-content > p' || 'not provided'

The || operator is a logical short circuit. If the expression on the left is true, that expression's value is returned, and the right-hand side is never evaluated. The string "div.abstract-content > p" is just a plain old string, and evaluates to true. Therefore, the 'not provided' string is never seen. You're not providing an alternate of choice, you're providing only one string as an option.

I'm guessing here but perhaps the path div.abstract-content > p doesn't resolve to anything in the DOM you are parsing. It might be useful for you to provide a sample of the dom, trimmed to show the relevant hierarchy.


Dave

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2021-09-20 14:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?