The docs for WWW::Mechanize state that the find_link() method
returns a reference to a two element array which has the link URL and link text, respectively. If it fails to find a link it returns undef.The returned value should be an array ref if it succeeded (not a hash as stated in your post). If you really are getting a hash ref, please post some code with example input and output so we can replicate it.
You can do something like this:
my $result = $a->find_link( text => "download" ); if( defined $result ) { my ( $url, $linktext ) = @{ $result }; # use $linktext here }
HTH
Update: This is true for WWW::Mechanize 0.48, the latest version that I found using PPM. The most recent version on CPAN (1.16) uses WWW::Mechanize::Link objects, as Your Mother indicated below.
In reply to Re: How do I return the text of a link after using find_link with WWW::Mechanize?
by bobf
in thread How do I return the text of a link after using find_link with WWW::Mechanize?
by SpacemanSpiff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |