in reply to Re^3: WWW::Mechanize - error on geting non-existing page
in thread WWW::Mechanize - error on geting non-existing page
…well, all examples really. Though it depends on how you see it. I never advocated ignoring return states.
Not finding a page online is not an exception(al case). It’s entirely normal. Should your car blow-up if a road-sign is missing or should the driver revisit the map? If you need to deal with any of the various 400s and 500s, it’s just easier on the hacker to not wrap it up in evals. The end code will have identical functionality: i.e., every request is checked for success or unexpected codes and then processed accordingly. All the exception handling buys you here is additional complexity (and the chance to fall into eval problems with disappearing $@ if you’re not careful).
The change to make this stuff fatal by default is recent-ish. For most of the life of Mech, it wasn’t this way so it was a pretty big style break for those of us using it from the beginning, and I think most LWP hackers are already accustomed to checking $response->is_success habitually.
There may be some value in the fatals for the newcomer who has incorrect expectations but for the experienced user of the kit it’s just an annoying hoop (and a bunch of broken scripts when the update came through but I digress… uh, and whine).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: WWW::Mechanize - error on geting non-existing page
by GrandFather (Saint) on Nov 06, 2011 at 20:14 UTC | |
by Your Mother (Archbishop) on Nov 06, 2011 at 21:50 UTC | |
by GrandFather (Saint) on Nov 06, 2011 at 22:31 UTC | |
by pemungkah (Priest) on Dec 05, 2011 at 22:38 UTC | |
by Anonymous Monk on Nov 07, 2011 at 06:34 UTC | |
|
Re^5: WWW::Mechanize - error on geting non-existing page
by Limbic~Region (Chancellor) on Nov 09, 2011 at 17:06 UTC |