Reputation: 25117
use WWW::Mechanize;
my $mech = WWW::Mechanize->new;
$mech->get( $url );
say $mech->text;
How could I get the same result with Mojo::UserAgent
?
I tried this, but it doesn't return the same:
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
say $ua->get( $url )->res->dom->all_text;
Upvotes: 1
Views: 581
Reputation: 9697
You can try
$ua->get( $url )->res->dom->all_text(0);
for untrimmed output. Or you may need some kind of traversal over child nodes.
Upvotes: 0