|
PException - Exception manager |
PException - Exception manager
use PException;
try {
throw( AnException->new() ) if $something;
throw( AnOtherException->new( [] ) )
unless $anotherthing;
}
catch AnException( sub { } ) ,
onfly AnOtherException( sub { } ) ;
local %_XCPHDL_ = (
EXCEPTIONS => [],
FLYS => [],
STACKFLY => [],
ONFLY => 0,
FRESH => 0,
CANDIE => 0
);
a try block is a code block which is evaluated.
when you throw a new set of exception, this set is pushed in @{$PException::_XCPHDL_->{EXCEPTIONS}} , the system call die.
then $SIG{__DIE__} check if any waitting may be catched, when it finish and there is waitting exception yet, it die, else it continues the try block ; it's the onfly exception handling.
the catching part is the same thing than upside, but you can't continue the execution of the try block.
Don't try to change $SIG{__WARN__} and $SIG{__DIE__} inside a try block.
Copyright (c) 1998-2003 Samuel MOUNIEE
This file is part of PException.
PException is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
PException is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with PException; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Samuel Mouniée <mouns@mouns.net>
|
PException - Exception manager |