summaryrefslogtreecommitdiffstats
path: root/lib/App/REPL/Plugin/Interrupt.pm
blob: d993a153dcfe5ca000319e4450966f5f192e7cc9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package App::REPL::Plugin::Interrupt;
use strict;
use warnings;

use base 'App::REPL::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;