What are the disadvantages of using a Perl debugger and a real REPL like Devel :: REPL?

I usually use perl -de 42 to get the Perl interactive shell. I saw Devel :: REPL and I saw some blogs, such as http://www.xenoterracide.com/2010/07/making-repl-usable.html , explaining how you can improve Devel::REPL with plugins but I haven't used it yet.

Is it too bad to use the debugger as an interactive shell? Why?

Note: The flaws mentioned in this PerlMonks node were limitations of the user, not the Perl debugger.

Where can I learn more about Perl REPL?

Is Devel :: REPL ready for the spotlight?

UPDATE: I accepted Pedro's answer because he answered the question I asked, but still I would like to know when and why (if any) using the Perl debugger as an interactive shell is a bad idea compared to one of the Perl implementations REPL, And which Perl REPL do you prefer?

+6
debugging perl
source share
3 answers

One of the drawbacks of perl -d is that lexical variables immediately go beyond the scope. Example:

 DB<1> my $p = 123; DB<2> print $p; DB<3> 

From perldebug :

Note that the specified eval is bound to implicit volume. As a result, a lexical variable or any modified contents of the capture buffer lost after evaluation is introduced. A debugger is a good environment for learning Perl, but if you are experimenting interactively using material that should be in the same volume, material in one linear object, write it on one line.

+8
source share

Instead of using a debugger and skipping functions, I usually use only

 perl -wnE'say eval()// $@ ' 

I used Devel :: REPL and something like this, but just not used to using it.

The advantage of using a debugger is that $DB::single=1 can also stop one-step at a given point.

+3
source share

Both have different goals. The debugger is optimized to debug an already written Perl script / program. While the main objective of REPL is to provide fast language feedback and optimization for interactive input (developers).

For example, if I do the following in the Perl debugger:

 DB<1> for my $x (1..10) { 

I get the error Missing right curly or square bracket at (eval 5)...

While Devel::REPL allows you to use multiple lines:

 $ for my $x (1..3) { > say $x; > } 1 2 3 

I fully recommend Devel::REPL , and with additional plugins it will become a convenient development tool that will work next to your editor.

/ I3az /

+1
source share

All Articles