View Single Post

   
  #2 (permalink)  
Old 01-05-2008, 09:08 AM
Paul Pluzhnikov
 
Posts: n/a
Default Re: structured exception handling

StephenRichter@gmail.com writes:

> Is there exception handling in AIX/Unix/Linux similar to how exceptions
> are handled in C++?


In what language? Yes, in C++.

> I have a unix programming book by Stevens and a
> couple of Perl books just arrived and I dont see any mention of
> throwing and catching exceptions.


Stevens book is all in C, and there is no structured exception
handling in that language.

> ( I just read about die, the non zero
> return value standard and stderr )


In Perl, you could 'catch' exceptions like this:

eval "some code which might die";
if ($@) { # did die ...

> An example might be a socket connection to a remote system. I always
> want that connection to shutdown in a way the remote system expects.
> Will a Perl script be able to catch all the potential dieing that could
> happen in the process and send a nice disconnect message to the remote
> system?


Sure.

However, if remote requires a nice disconnect, it is broken: think
what would happen if you cut the network cable from local host
(while the app is running), then reboot it and plug it back in.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Reply With Quote