libwww-perl / WWW-Mechanize

Handy web browsing in a Perl object
https://metacpan.org/pod/WWW::Mechanize
Other
68 stars 53 forks source link

WM: failed $mech->follow_link(text => 'nonexistent') makes $mech->success still return true! #137

Open spazm opened 7 years ago

spazm commented 7 years ago

peteris....@gmail.com reported on Mar 31, 2008

What steps will reproduce the problem?
1. perl -MWWW::Mechanize -wle '$mech = WWW::Mechanize->new;
$mech->get(q|http://reddit.com|); $mech->follow_link(text => q|this is
nonexistent!|); print $mech->success ? qq|true\n| : qq|false\n|'

What is the expected output? What do you see instead?
Expected output is 'false'. I see 'true' instead.

What version of the product are you using? On what operating system?
I am using Mech 1.34 on Unix and Windows.

Please provide any additional information below.
I did not yet check the source to see why it happens this way, and as you said:
[19:57:52] <alester> Be careful when you say it's a "bug" that success
still returns true.
[19:58:01] <alester> To you it's unexpected.
[19:58:06] <alester> To someone else, it might be right.

Details

Imported from Google Code issue 46 via archive

Comments

petda...@gmail.com commented on Nov 25, 2008 :

(No comment was entered for this change.)

pmuhlc...@gmail.com commented on Mar 1, 2009 :

I've written some code to find links to speeches by Presidential candidate John
McCain on the NYTimes.  The page returns results of a query on the NYTimes search
engine.  This particular page does not have a 'next' page link on it, so the
follow_link should return not successful, but it returns successful.  Also, the $mech
object should become undefined, instead it continues to contain the first page loaded
into it.  This is a serious problem.  I'll try followable links to see if that can
provide a workaround. 

My perl version:

This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi

petda...@gmail.com commented on Jun 23, 2009 :

(No comment was entered for this change.)

petda...@gmail.com commented on Jul 6, 2009 :

(No comment was entered for this change.)
simbabque commented 4 years ago

This has been fixed in d830a7e3 and it now dies with Link not found because autocheck is on by default. We should still have a test for it though. I've referred the issue to one of my team at $work who wants to get some practice at contributing to open source, so we should hopefully see a PR soon.