in reply to Custom interrupt?
Just as a reminder, there are excellent database moduls on CPAN, for example DBM::Deep. They are well tested and might spare you a lot of work.
Your immediate problem might be solved by putting the prompt in a subroutine with the escape checking. Parameters of the subroutine would a flag whether ESC is allowed and the parameters to prompt(). Return values are the return value of prompt() plus a boolean to show whether ESC was pressed. Inside this subroutine you could do the write_to_db
If you really want an interrupt thingy, that can be simulated with putting your code inside an eval and die'ing when someone hits ESC. This is sadly the meager substitute for exceptions/interrupts in perl5.
|
|---|