SPUG: Re: die from BEGIN; how suppress ugly message?

jimfl jimfl at colltech.com
Wed Jan 26 17:03:15 CST 2000


--On Wednesday, January 26, 2000 2:05 PM -0800 "Tim Maher/CONSULTIX"
<tim at consultix-inc.com> wrote:


     > > Does anybody know an elegant, simple (might be asking too much
     > there) > way to trap/suppress/avoid this kind of ugly message when I
     > call > exit or die from within BEGIN?
     > > 
     > > $ turbo_fax
     > > Usage: turbo_fax  file1 [file2 . . .]
     > > BEGIN failed--compilation aborted at ./in_place line 19.
     > > $
     > 
     > Had a brainstorm just after posting the question to the list:
     > 	 open STDERR, "> /dev/null"
     > does the trick.  Anybody know other solutions?

  You should only get the ickyness on a die, not on an exit. You can trap
  the die, and exit gracefull with some variation on the theme:
  
      BEGIN {
        $SIG{__DIE__} = sub{exit};
        ...
        die();
        ...
      }

--
Jim Flanagan          Collective Technologies
jimfl at colltech.com   http://www.colltech.com

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list