summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/Interrupt.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Reply/Plugin/Interrupt.pm')
-rw-r--r--lib/Reply/Plugin/Interrupt.pm23
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;