Subject: | Can't call method "__click" on an undefined value at ...WWW/Mechanize/FireFox.pm line 844, <DATA> line 1. |
Date: | Tue, 17 Nov 2009 21:24:34 -0500 |
To: | bug-WWW-Mechanize-FireFox [...] rt.cpan.org |
From: | Carey Drake <carey [...] frieduck.com> |
Corion,
I found a small bug in the follow_link method of WMF. Specifically, when it's not called with a link parameter, it produces the error:
Can't call method "__click" on an undefined value at ...WWW/Mechanize/FireFox.pm line 844,<DATA> line 1.
because of a misplaced "my". Changing:
sub follow_link {
my ($self,$link,%opts);
if (@_ == 2) { # assume only a link parameter
($self,$link) = @_
} else {
($self,%opts) = @_;
my $link = $self->find_link_dom(%opts);
}
$self->synchronize( sub {
$link->__click();
});
$self->response
}
to:
sub follow_link {
my ($self,$link,%opts);
if (@_ == 2) { # assume only a link parameter
($self,$link) = @_
} else {
($self,%opts) = @_;
$link = $self->find_link_dom(%opts);
}
$self->synchronize( sub {
$link->__click();
});
$self->response
}
fixes the problem.
Regards,
Carey