[664] lib/App/Prove.pm - teach Getopt::Long about error handling

Eric Wilhelm scratchcomputing at gmail.com
Wed Oct 3 08:39:41 BST 2007


So, Getopt::Long does local $SIG{__DIE__} = "__DEFAULT__" and then eval, 
and then print STDERR $@ unless the $@ is "!FINISH".  This basically 
means that error propagation is impossible without a workaround.

This hack means that subrefs in the options can die to stop option 
processing.  While they could exit(1) if this were not an API, this is 
an API, so...  It also means bad options and thrown errors are 
different.

That brings up an issue of documenting App::Prove as an API vs just the 
usage (e.g. help, version, etc should exit, but should be documented as 
such.)  I think Andy said something about having dealt with that in 
ack.

--Eric
-- 
"...our schools have been scientifically designed to
prevent overeducation from happening."
--William Troy Harris
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the tapx-dev mailing list