mstpan 17 - Interactive shells
Sometimes it's nice to have a conversation with the computer that isn't you shouting four letter words at it.
Before you start
Install Term::ReadLine::Gnu. You'll likely need libreadline-dev or readline-devel or whatever your particular OS calls it, but this will give Term::ReadLine actual readline support, which will make whatever you're using infinitely more pleasant.
If for whatever reason you can't do that, there is also Term::ReadLine::Perl5 which is a pretty decent plan B.
perl -de 0
This basically starts the debugger with a -e script of '0'.
If you spend a lot of time in the debugger anyway, this is almost certainly worth trying, simply because all the commands you're used to will already work. However note that it doesn't have a persistent lexical environment, so you have to use global variables, which, given I don't generally use interactive debuggers is quite sufficient to make me personally run a mile.
I wrote this. Lots of other people added lots of fascinating plugins to it.
But it's quite old, and it uses Moose so has a bit of a startup time, and I inevitably made a bunch of design mistakes in the process.
On the other hand, re.pl is still the best name for a perl REPL ever.
Carp::REPL and Plack::Middleware::REPL
These are both basically on-error-provide-Devel::REPL modules, and are well worth a look if that's something you're interested in.
Whether or not you find this preferable when compared to, e.g., $DB::Single in a SIGDIE is a matter of taste.
tinyrepl from Eval::WithLexicals
I ... also wrote this. And use it most days, because it turns out that other than readline support and a persistent lexical environment I don't actually care about REPL features. If you're similar, you may find this useful. If you want to write your own, it's a nice bare minimum place to start (I've got a few per-project versions of it that I copy-pasted and tweaked, and it's simple enough that actually isn't that horrible).
It's also worth noting that Eval::WithLexicals is pure perl, so you can fatpack things based upon it.
Reply is basically ... if I'd not found tinyrepl to have sufficient features for me, and sat down and properly thought out how you'd design a pluggable REPL from scratch, knowing all the things about the Devel::REPL internals that are annoying, I can only hope it would have come out as sensible as Reply.
If you want a featureful REPL, this would be my current recommendation. It comes with a number of plugins and there's a bunch more out there on the CPAN.
'perl -de 0' if you're already a debugger fanatic, tinyrepl for ultimate minimalism, Reply for everybody else. Also: Make sure you install Term::ReadLine::Gnu first!
-- mst, out.