diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-05-29 01:03:24 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-05-29 01:03:24 -0500 |
commit | 16ab48377311331748fe7b6e109d31822200968e (patch) | |
tree | d08189f37319fcea50ec18ca2aa0d5c3c29e88a4 /lib/App/REPL/Plugin/Defaults.pm | |
parent | f57cbd571049fcff4656a8c8b4f1ea6344ef4626 (diff) | |
download | reply-16ab48377311331748fe7b6e109d31822200968e.tar.gz reply-16ab48377311331748fe7b6e109d31822200968e.zip |
plugins
Diffstat (limited to 'lib/App/REPL/Plugin/Defaults.pm')
-rw-r--r-- | lib/App/REPL/Plugin/Defaults.pm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/App/REPL/Plugin/Defaults.pm b/lib/App/REPL/Plugin/Defaults.pm new file mode 100644 index 0000000..f2b4705 --- /dev/null +++ b/lib/App/REPL/Plugin/Defaults.pm @@ -0,0 +1,34 @@ +package App::REPL::Plugin::Defaults; +use strict; +use warnings; + +use base 'App::REPL::Plugin'; + +sub display_prompt { + my $self = shift; + + print "> "; +} + +sub read_line { + my $self = shift; + + return scalar <>; +} + +sub evaluate { + my $self = shift; + my ($next, $line) = @_; + + return eval $line; +} + +sub print_result { + my $self = shift; + my ($next, $result) = @_; + + print $result, "\n" + if defined $result; +} + +1; |