Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Mechanize to TreeBuilder-XPath

by kelchris (Novice)
on Jan 27, 2012 at 03:30 UTC ( #950254=note: print w/ replies, xml ) Need Help??


in reply to Mechanize to TreeBuilder-XPath

I would suggest using Mojo::UserAgent

use strict; use Mojo::UserAgent; my $ua = Mojo::UserAgent->new; my $tx = $ua->get("www.amazon.com"); $ua->max_redirects(5); $tx->res->dom('li.navSaChildItem')->each(sub { my $item = $_; print "[CSS3 Selector] Departments: ".$item->a->text."\n"; }); print "Title: ".$tx->res->dom->html->head->title->text."\n";


Comment on Re: Mechanize to TreeBuilder-XPath
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2015-07-28 09:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls