diff options
Diffstat (limited to 'lib/App/REPL/Plugin/Interrupt.pm')
-rw-r--r-- | lib/App/REPL/Plugin/Interrupt.pm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/App/REPL/Plugin/Interrupt.pm b/lib/App/REPL/Plugin/Interrupt.pm new file mode 100644 index 0000000..346807e --- /dev/null +++ b/lib/App/REPL/Plugin/Interrupt.pm @@ -0,0 +1,15 @@ +package App::REPL::Plugin::Interrupt; +use strict; +use warnings; + +use base 'App::REPL::Plugin'; + +sub evaluate { + my $self = shift; + my ($next, $line, %args) = @_; + + local $SIG{INT} = sub { die "Interrupted" }; + $next->($line, %args); +} + +1; |