mbrouillet has asked for the wisdom of the Perl Monks concerning the following question:
I get a «^C» character displayed when I hit CTRL-C, but the signal is only processed once I type the Enter key. Here is the output :#!/usr/bin/perl use Term::ReadLine; use sigtrap 'handler' => \&myhand, 'INT'; sub myhand { print "\n caught $SIG{INT}",@_,"\n"; } my $term = Term::ReadLine->new('test'); print $term->ReadLine()."\n"; $term->readline("try CTRL-C in some text here :");
How can I catch it sooner ? Thanks.marcel@machine:/tmp$ perl test.pl Term::ReadLine::Gnu try CTRL-C in some text here :auie ^C caught CODE(0x558c9e99acb0)INT marcel@machine:/tmp$
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Catching INT in Term::ReadLine::Gnu->readline()
by hippo (Archbishop) on Jul 03, 2019 at 11:00 UTC | |
|
Re: Catching INT in Term::ReadLine::Gnu->readline()
by gnosti (Chaplain) on Jul 03, 2019 at 18:45 UTC |