diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-05-30 04:41:11 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-05-30 04:41:11 -0500 |
commit | d8a90a03e9c5e8e2732374a10e0e79289ffb793c (patch) | |
tree | 98b6385d26dad2a14687c2c51d402c5b6ebdc837 /lib/Reply/Plugin/Interrupt.pm | |
parent | 69e4ff7c28debe5cae5bd505d5df12bd12bdd11a (diff) | |
download | reply-d8a90a03e9c5e8e2732374a10e0e79289ffb793c.tar.gz reply-d8a90a03e9c5e8e2732374a10e0e79289ffb793c.zip |
App::REPL -> Reply
Diffstat (limited to 'lib/Reply/Plugin/Interrupt.pm')
-rw-r--r-- | lib/Reply/Plugin/Interrupt.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Reply/Plugin/Interrupt.pm b/lib/Reply/Plugin/Interrupt.pm new file mode 100644 index 0000000..a5c2b37 --- /dev/null +++ b/lib/Reply/Plugin/Interrupt.pm @@ -0,0 +1,23 @@ +package Reply::Plugin::Interrupt; +use strict; +use warnings; + +use base 'Reply::Plugin'; + +sub compile { + my $self = shift; + my ($next, @args) = @_; + + local $SIG{INT} = sub { die "Interrupted" }; + $next->(@args); +} + +sub execute { + my $self = shift; + my ($next, @args) = @_; + + local $SIG{INT} = sub { die "Interrupted" }; + $next->(@args); +} + +1; |