File: remoterepl

package info (click to toggle)
libobject-remote-perl 0.004000-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 488 kB
  • ctags: 248
  • sloc: perl: 2,408; makefile: 7
file content (29 lines) | stat: -rwxr-xr-x 684 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env perl

use strictures 1;
use Object::Remote;
use Eval::WithLexicals;
use Term::ReadLine;
use Data::Dumper;

$SIG{INT} = sub { warn "SIGINT\n" };

{ package Data::Dumper; no strict 'vars';
  $Terse = $Indent = $Useqq = $Deparse = $Sortkeys = 1;
  $Quotekeys = 0;
}

#{ no warnings 'once'; $Object::Remote::Connection::DEBUG = 1; }

my $eval = Eval::WithLexicals->new::on($ARGV[0]||'-');

my $read = Term::ReadLine->new('Perl REPL');
while (1) {
  my $line = $read->readline('re.pl$ ');
  exit unless defined $line;
  my @ret; eval {
    local $SIG{INT} = sub { die "Caught SIGINT" };
    @ret = $eval->eval($line); 1;
  } or @ret = ("Error!", $@);
  print Dumper @ret;
}