in reply to How do I return the text of a link after using find_link with WWW::Mechanize?
The links in WWW::Mechanize are WWW::Mechanize::Link objects. So you have to use their methods to get more than their auto-stringification.
use strict; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->get('http://amazon.com/'); $mech->success or die $mech->status(); my $link_obj = $mech->find_link (text_regex => qr/computer/i ); printf( "%s\n\t%s\n\n", $link_obj->text(), $link_obj->url(), );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I return the text of a link after using find_link with WWW::Mechanize?
by SpacemanSpiff (Sexton) on Nov 09, 2005 at 22:35 UTC |