|
||||||||||
Perl Exception HandlingException handling mechanism, the eval {} block.Implemented by wrapping the code that needs to be executed around an eval block and the $@ variable is checked to see if an exception occurred. eval { Within the eval block, in case a syntax error or runtime error, or a die statement is executed, then an undefined value is returned by eval, and $@ is set to the error message. Since the error message store in $@ is a simple scalar, checking the type of error that has occurred is error prone $@ does not tell where the exception occurred. Starting from Perl 5.005, Exception Handling can be done: eval { if ($@) { MyFileException exception class can be built with as much functionality as desired. SOURCE: Perl Documentation ONLINE RESOURCES: Official Perl website Download Perl Open Directory Project The Perl Foundation Perl Blogs Perl Forum |
||||||||||