Subject: | follow_link() bails when find_link() fails |
In follow_link():
*snip*
my $link = $self->find_link(%parms);
return $self->get( $link->url ) if $link;
$self->die( 'Link not found: ', $link->url ) if $self->{autocheck};
*snip*
if find_link() fails (e.g. $mech->follow_link(text_regex => qr/Next/)
when there is no Next link) $link->url is broken. I get:
Can't call method "url" on an undefined value at
/usr/lib/perl5/site_perl/5.8.8/WWW/Mechanize.pm line 707.
It seems that find_link() does not perform autocheck if it fails (makes
sense to me) so perhaps follow_link() should not perform this check when
find_link() fails. Dunno, just thought I'd mention this.
Environment data:
Centos 5.2 x86_64 Linux kernel 2.6.26
[tstrader@python ~]$ perl -v
This is perl, v5.8.8 built for x86_64-linux-thread-multi
Copyright 1987-2006, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.