diff options
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; |