Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Neat Debugger tricks

by VSarkiss (Monsignor)
on Nov 16, 2005 at 20:42 UTC ( #509183=note: print w/ replies, xml ) Need Help??


in reply to Neat Debugger tricks

Not so much a trick in the debugger, but I like to use it as an "interactive Perl shell", using a command like perl -de 1. Of course, any expression other than -e 1 will work, I'm just used to that one.

For example, if you're wondering whether a particular regex will match, or whether your split will work as you intended, but you don't want to mess around with shell quotes, just:

$ perl -de 1 Loading DB routines from perl5db.pl version 1.25 Editor support available. Enter h or `h h' for help, or `perldoc perldebug' for more help. main::(-e:1): 1 DB<1> $s = '12345' DB<2> x split(/(?<=\d)/, $s) 0 1 1 2 2 3 3 4 4 5 DB<3> q # yup, it works
I believe I first read about this in Effective Perl Programming.


Comment on Re: Neat Debugger tricks
Select or Download Code
Re^2: Neat Debugger tricks
by siracusa (Friar) on Nov 17, 2005 at 13:22 UTC
    I've always used "perl -de 0", but the too-clever version used to impress or confuse people is "perl -demo" :)

      I like perl -deal. Or, since we’re on PerlMonks, maybe perl -deacon?

      (Another classic, though it has nothing to do with the debugger, is perl -please as a fun if expensive replacement for cat.)

      Makeshifts last the longest.

        Then I suppose Grandmother would like perl -dearie ???

        And those bioperl folks would choose perl -deoxyribonucleic acid ?

        And the anti-DRM crowd would go for perl -decss ??

        Archeologists: perl -decrypt

        And when everyone is tired of this, I'll be asked to perl -desist ;)

        -QM
        --
        Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://509183]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2014-10-24 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (131 votes), past polls