X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FEval-WithLexicals.git;a=blobdiff_plain;f=bin%2Ftinyrepl;h=6d52ba6e9c8ee53090b322fd5d7834e113608105;hp=236b081eb1f9b182217f83b8e26aa13e7cc07d89;hb=2b376bd0dc102f9019e007d889a844f94b3a87b9;hpb=51e1f1e1c713c85f5140ee7776d13b7d5726505b diff --git a/bin/tinyrepl b/bin/tinyrepl index 236b081..6d52ba6 100755 --- a/bin/tinyrepl +++ b/bin/tinyrepl @@ -4,6 +4,11 @@ use strictures 1; use Eval::WithLexicals; use Term::ReadLine; use Data::Dumper; +use Getopt::Long; + +GetOptions( + "plugin=s" => \my @plugins +); $SIG{INT} = sub { warn "SIGINT\n" }; @@ -12,7 +17,10 @@ $SIG{INT} = sub { warn "SIGINT\n" }; $Quotekeys = 0; } -my $eval = Eval::WithLexicals->new; +my $eval = @plugins + ? Eval::WithLexicals->with_plugins(@plugins)->new + : Eval::WithLexicals->new; + my $read = Term::ReadLine->new('Perl REPL'); while (1) { my $line = $read->readline('re.pl$ '); @@ -23,3 +31,47 @@ while (1) { } or @ret = ("Error!", $@); print Dumper @ret; } + +__END__ + +=head1 NAME + +tinyrepl - Tiny REPL + +=head1 SYNOPSIS + + $ tinyrepl + re.pl$ "s" x 5 + "sssss" + re.pl$ exit + + $ tinyrepl --plugin HintPersistence + +=head1 DESCRIPTION + +tinyrepl is a minimal pure-Perl REPL. It is just a small wrapper +around L. + +=head1 OPTIONS + +=over 4 + +=item C<--plugin=> + +Loads a plugin into the REPL. See L. + +=back + +=head1 SUPPORT + +See L for support and contact information. + +=head1 AUTHORS + +See L for authors. + +=head1 COPYRIGHT AND LICENSE + +See L for the copyright and license. + +=cut