summaryrefslogtreecommitdiffstats
path: root/lib/App/REPL/Plugin/Defaults.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/REPL/Plugin/Defaults.pm')
-rw-r--r--lib/App/REPL/Plugin/Defaults.pm34
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;