in reply to Custom interrupt?
If that is the case, here's another 'solution':
our $ESC_EXIT_LABEL; sub my_prompt { my $input = prompt @_, -escape if ($input eq "\e" && $ESC_EXIT_LABEL) { goto $ESC_EXIT_LABEL; } return $input; } sub enter_products { ... local($ESC_EXIT_LABEL) = "enter_products_esc_label"; while (1) { ... call my_prompt many times... } enter_products_esc_label: write_database(...); }
|
|---|