Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Mojo::DOM find tag after another tag

by luxs (Beadle)
on May 29, 2016 at 19:30 UTC ( [id://1164456]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Mojo::DOM find tag after another tag
in thread Mojo::DOM find tag after another tag

Nice script, but it fails if between H1 and IMG occur other tags.
my $data = 'yada...yada...yada.. <img src="111"> yada...yada...yada.. <img src="222"> yada...yada...yada.. <h1>Some title</h1> yada...yada...yada.. <a href="444444"> <img src="333"> yada...yada...yada.. <img src="444">'; my $dom = Mojo::DOM->new($data); for my $img ( $dom->find(q{h1 ~ img})->each ) { print $img->attr(q{src}); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-23 20:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found