ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages

 

This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

For more information about the manual page format, see the manual page for manpages(5).



Fatal(3pm)                            Perl Programmers Reference Guide                            Fatal(3pm)



NAME
       Fatal - replace functions with equivalents which succeed or die

SYNOPSIS
           use Fatal qw(open close);

           sub juggle { . . . }
           import Fatal 'juggle';

DESCRIPTION
       "Fatal" provides a way to conveniently replace functions which normally return a false value when
       they fail with equivalents which raise exceptions if they are not successful.  This lets you use
       these functions without having to test their return values explicitly on each call.  Exceptions can
       be caught using "eval{}".  See perlfunc and perlvar for details.

       The do-or-die equivalents are set up simply by calling Fatal's "import" routine, passing it the names
       of the functions to be replaced.  You may wrap both user-defined functions and overridable CORE oper-ators operators
       ators (except "exec", "system" which cannot be expressed via prototypes) in this way.

       If the symbol ":void" appears in the import list, then functions named later in that import list
       raise an exception only when these are called in void context--that is, when their return values are
       ignored.  For example

               use Fatal qw/:void open close/;

               # properly checked, so no exception raised on error
               if(open(FH, "< /bogotic") {
                       warn "bogo file, dude: $!";
               }

               # not checked, so error raises an exception
               close FH;

AUTHOR
       Lionel.Cons@cern.ch

       prototype updates by Ilya Zakharevich ilya@math.ohio-state.edu



perl v5.8.8                                      2001-09-21                                       Fatal(3pm)

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.