diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-05-30 04:41:11 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-05-30 04:41:11 -0500 |
commit | d8a90a03e9c5e8e2732374a10e0e79289ffb793c (patch) | |
tree | 98b6385d26dad2a14687c2c51d402c5b6ebdc837 /lib/App/REPL/Plugin/Defaults.pm | |
parent | 69e4ff7c28debe5cae5bd505d5df12bd12bdd11a (diff) | |
download | reply-d8a90a03e9c5e8e2732374a10e0e79289ffb793c.tar.gz reply-d8a90a03e9c5e8e2732374a10e0e79289ffb793c.zip |
App::REPL -> Reply
Diffstat (limited to 'lib/App/REPL/Plugin/Defaults.pm')
-rw-r--r-- | lib/App/REPL/Plugin/Defaults.pm | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/lib/App/REPL/Plugin/Defaults.pm b/lib/App/REPL/Plugin/Defaults.pm deleted file mode 100644 index ab533b4..0000000 --- a/lib/App/REPL/Plugin/Defaults.pm +++ /dev/null @@ -1,64 +0,0 @@ -package App::REPL::Plugin::Defaults; - -# XXX Eval::Closure imposes its own hints on things that are eval'ed at the -# moment, but this may be fixed in the future -BEGIN { - our $default_hints = $^H; - our $default_hinthash = { %^H }; - our $default_warning_bits = ${^WARNING_BITS}; -} - -use strict; -use warnings; - -use base 'App::REPL::Plugin'; - -use Eval::Closure; - -sub prompt { "> " } - -sub read_line { - my $self = shift; - my ($next, $prompt) = @_; - - print $prompt; - return scalar <>; -} - -my $PREFIX = "package main; BEGIN { \$^H = \$" . __PACKAGE__ . "::default_hints; \%^H = \%\$" . __PACKAGE__ . "::default_hinthash; \${^WARNING_BITS} = \$" . __PACKAGE__ . "::default_warning_bits }"; - -sub compile { - my $self = shift; - my ($next, $line, %args) = @_; - - return eval_closure( - source => "sub { $PREFIX; $line }", - terse_error => 1, - %args, - ); -} - -sub execute { - my $self = shift; - my ($next, $code) = @_; - - return $code->(); -} - -sub print_error { - my $self = shift; - my ($next, $error) = @_; - - print $error - if defined $error; -} - -sub print_result { - my $self = shift; - my ($next, @result) = @_; - - print @result, "\n" - if @result; -} - -1; |