Document hints plugin
[p5sagit/Eval-WithLexicals.git] / bin / tinyrepl
CommitLineData
51e1f1e1 1#!/usr/bin/env perl
2
6f914695 3use strictures 1;
4use Eval::WithLexicals;
5use Term::ReadLine;
51e1f1e1 6use Data::Dumper;
7
3fb66cc7 8use Getopt::Long;
9
10GetOptions(
11 "plugin=s" => \my @plugins
12);
13
51e1f1e1 14$SIG{INT} = sub { warn "SIGINT\n" };
15
16{ package Data::Dumper; no strict 'vars';
17 $Terse = $Indent = $Useqq = $Deparse = $Sortkeys = 1;
18 $Quotekeys = 0;
19}
6f914695 20
3fb66cc7 21my $eval = @plugins
22 ? Eval::WithLexicals->with_plugins(@plugins)->new
23 : Eval::WithLexicals->new;
24
6f914695 25my $read = Term::ReadLine->new('Perl REPL');
26while (1) {
27 my $line = $read->readline('re.pl$ ');
28 exit unless defined $line;
51e1f1e1 29 my @ret; eval {
6f914695 30 local $SIG{INT} = sub { die "Caught SIGINT" };
51e1f1e1 31 @ret = $eval->eval($line); 1;
32 } or @ret = ("Error!", $@);
6f914695 33 print Dumper @ret;
34}