REPL for Perl
Unfortunately, perl, with all its advantages, has one significant
drawback - unlike the same python, the perl interpreter does not provide
a full-fledged REPL out of the box. REPL allows you to enter commands in a step-by-step mode, which
is often useful when performing semi-automatic testing. Or if you are
firmly convinced that the small piece of code that you want to sketch to
solve the short-term problem, you will never need it again. At the moment
, there are 3 main options for implementing REPL in the language. Each with its own
advantages and disadvantages.
What we get on command:
It is a debugger for its intended purpose, and the fact that you will use it as a REPL will remain
on your conscience. Suitable when there is nothing at hand - this method does not require the
installation of any additional modules. Of the minuses - the lack of support for
multi-line commands and a lot of small differences from the full perl, which are easier to
feel yourself than to formulate.
You get a full REPL with chips and tricks. If you wait until
all the dependencies are installed. In the event of a successful installation, you will get everything:
- TAB auto-completion for keywords, variables, functions, etc.
- input multi-line blocks. On many lines
- the history of commands, saved from session to session
- startup speed comparable to the Groovy interpreter
- text highlighting
This miracle is launched by the re.pl command.
There are much fewer dependencies than the previous version, but not much less
features. Of the tangible ones, you cannot enter multiline blocks, although for
this you can call an external editor. Of the useful features, it is
possible to reload all modules before each command is executed, which, when
used correctly, speeds up the debugging process compared to
running it through a regular debugger multiple times .
It is launched by the reply command.
drawback - unlike the same python, the perl interpreter does not provide
a full-fledged REPL out of the box. REPL allows you to enter commands in a step-by-step mode, which
is often useful when performing semi-automatic testing. Or if you are
firmly convinced that the small piece of code that you want to sketch to
solve the short-term problem, you will never need it again. At the moment
, there are 3 main options for implementing REPL in the language. Each with its own
advantages and disadvantages.
Ordinary debugger
What we get on command:
perl ‐d ‐e 1
It is a debugger for its intended purpose, and the fact that you will use it as a REPL will remain
on your conscience. Suitable when there is nothing at hand - this method does not require the
installation of any additional modules. Of the minuses - the lack of support for
multi-line commands and a lot of small differences from the full perl, which are easier to
feel yourself than to formulate.
Devel :: REPL module.
You get a full REPL with chips and tricks. If you wait until
all the dependencies are installed. In the event of a successful installation, you will get everything:
- TAB auto-completion for keywords, variables, functions, etc.
- input multi-line blocks. On many lines
- the history of commands, saved from session to session
- startup speed comparable to the Groovy interpreter
- text highlighting
This miracle is launched by the re.pl command.
Reply module.
There are much fewer dependencies than the previous version, but not much less
features. Of the tangible ones, you cannot enter multiline blocks, although for
this you can call an external editor. Of the useful features, it is
possible to reload all modules before each command is executed, which, when
used correctly, speeds up the debugging process compared to
running it through a regular debugger multiple times .
It is launched by the reply command.