in reply to Re: Eval not catching Dies
in thread Eval not catching Dies

> Are you trying to catch the die() after the eval{}?
No. The purpose of the die() is to 'terminate' the read from STDIN. Outside the eval, I don't care if it died. I just check to see if the user input anything for $cmd, and then I process that.
> perldoc for alarm says that the die() in the sig handler must terminate with a newline
Okay. I'll add one. However, that begs the question of "Why does it have to have a newline?" I tested alarm handlers before without newlines and they work. This looks like an artifact to me.

Replies are listed 'Best First'.
Re: Re: Re: Eval not catching Dies
by Anonymous Monk on Dec 08, 2003 at 19:16 UTC
    Well, I figured out the 'newline' issue. Adding a newline at the end of the die() text suppresses the addition of 'at xxx line #.'. The newline comment in the alarm code example is given because of the 'eq "alarm\n" conditional further down. Without the newline, the same conditional can be realized using '=~ /^alarm/'. Therefore, the newline is not germane to my problem. (Although, I did add one.)