Other operating systems may handle this case differently.
Monday, January 30th, 2006but this is rather ineffectual for several reasons. First, we don’t know why the program is dying (without parsing the argument, which is an arbitrary string). Second, we don’t know where the program is dying without parsing the line number out of the argument (but when you think about it, that information is absolutely useless inside your program). And third, the Faustian bargain that this handler has made lasts only as long as it does; as soon as the handler exits, your program dies anyway.[7] [7] Unlike real signal handlers, which return to whatever code was executing when the signal arrived. Fortunately, there is an approach that solves two of these problems at the same time, which is to use the block form of the eval operator. Put the code you want to check on in the block, and if anything inside it causes it to die, Perl will transfer control to the end of the block and put the message from die in the special variable $@. For example, my %dotfiles; while (my ($username, $home) = (getpwent)[0,7]) { eval { opendir HOME, $home or die “$home: $!”; foreach (grep -f && /^./, readdir HOME) { open DOT, “$home/$_” or die “$_: $!”; $dotfiles{$username}{$_} = () =
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision tomcat hosting services
Posted in perl | No Comments »