X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FInterrupt.pm;fp=lib%2FDevel%2FREPL%2FPlugin%2FInterrupt.pm;h=1d79bd8af77e726737dcf86c75829ff95769a8c7;hb=54d0f9a0eb9822d8d5973cc0e8aac52fab238245;hp=0000000000000000000000000000000000000000;hpb=314f229330cdc3be301a39eadb68ff8f2bf13043;p=p5sagit%2FDevel-REPL.git diff --git a/lib/Devel/REPL/Plugin/Interrupt.pm b/lib/Devel/REPL/Plugin/Interrupt.pm new file mode 100644 index 0000000..1d79bd8 --- /dev/null +++ b/lib/Devel/REPL/Plugin/Interrupt.pm @@ -0,0 +1,18 @@ +package Devel::REPL::Plugin::Interrupt; + +use Moose::Role; +use namespace::clean -except => [ 'meta' ]; + +around 'eval' => sub { + my $orig = shift; + my ($self, $line) = @_; + + local $SIG{INT} = sub { + die "Interrupted.\n"; + }; + + return $self->$orig($line); +}; + +1; +