NAME
FP::Repl::Repl - read-eval-print loop
SYNOPSIS
my $repl = new FP::Repl::Repl;
$repl->set_prompt("foo> ");
# ^ if left undefined, "$package$perhapslevel> " is used
$repl->set_historypath("path/to/dir"); # default is ~/.fp-repl_history
$repl->set_env_PATH ($safe_PATH); # default in taint mode is
# '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
# $ENV{PATH} otherwise. Is only used for running tooling for the
# repl itself, like the pager.
$repl->run;
# or $repl->run($skip) to skip $skip levels
DESCRIPTION
Enters an interactive read-eval-print loop. Term::ReadLine with history is active. The loop can be exited by typing ctl-d. Entering nothing re-evaluates the last entry. Some autocompletion exists.
When the entered line starts with ':' or ',' (both characters are equivalent), then it is interpreted as containing special commands or modes. Enter ':h' or ':help' or ':?' (or the equivalents starting with the comma like ',?', from now on whenever the text days ':' you can also use the comma) to get a help text including the currently active settings.
If the 'Maybe_keepResultIn' field is set to a string, the scalar with the given mae is set to either an array holding all the result values (in :l mode) or the result value (in :1 mode).
By default, in the :d / :s / :S modes the results of a calculation are carried over to the next entry in $VAR1 etc. as shown by the display of the result. Those are lexical variables.
This does not turn on the Perl debugger, hence programs are not slowed down.
FEATURES
Read the help text that is displayed by entering ":h", ",h", ":?" or ",?" in the repl.
TODO
- 'A::Class-> ' method completion
- for '$Foo ->bar<tab>' completion, if $Foo contains a valid class
name, use it
- maybe '$ans->[1]->' method completion
IDEAS
- should stdout and stderr of the evaluation context go to the pager,
too?
- maybe handle ->SUPER:: completion?
- differ between emptylistofcompletions (no &subs for example) (empty
list) and no sigil there so dunno-how-to-complete (undef?,
exception?, ??).
- make package lexicals accessible when entering a package with :p
BUGS
Completion:
- $ does not filter out scalars only, since perl is not able to do so
- % and * make completion stop working unless you put a space after
those sigils. (@ and & work as they should)
- keep the last 10 or so completion lists, and use those in the ->
case if the var's type could not be determined.
:V breaks view of :e and similar (shows CODE..)
SEE ALSO
FP::Repl: easy wrapper
NOTE
This is alpha software! Read the status section in the package README or on the website.