Stories
Slash Boxes
Comments

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

acme (189)

acme
  (email not shown publicly)
http://www.astray.com/

Leon Brocard (aka acme) is an orange-loving Perl eurohacker with many varied contributions to the Perl community, including the GraphViz module on the CPAN. YAPC::Europe was all his fault. He is still looking for a Perl Monger group he can start which begins with the letter 'D'.

Journal of acme (189)

Tuesday March 29, 2005
10:51 AM

Comments in the Perl debugger

[ #23905 ]
Here is a list of amusing comments or bits of code I have found in the Perl debugger. They make me laugh, they make me cry:

# Before venturing further into these twisty passages, it is
# wise to read the perldebguts man page or risk the ire of dragons.

# This would probably be better done with "use vars", but that wasn't around
# when this code was originally written. (Neither was "use strict".) And on
# the principle of not fiddling with something that was working, this was
# left alone.

# This was an attempt to clear out the previous values of various
# trapped errors. Apparently it didn't help. XXX More info needed!

@RememberOnROptions = qw(DollarCaretP OnlyAssertions);

# Just exactly what part of the word "CORE::" don't you understand?

# Here begin the unreadable code.  It needs fixing.

# XXX This looks like a bug to me.
# Why copy to @ARGS and then futz with @args?

# No signal is active.
$signal = 0;

# Hey, show's over. The debugged program finished
# executing already.

# local *dbline = *dbline; # XXX Would this work?!

# If the pattern isn't null ...
if ( $inpat ne "" ) {

# Can't run shell commands with Unicode in the debugger, hmm.
$cmd =~ /^$sh$sh\s*([\x00-\xff]*)/ && do {

# The following code may be executed now:
# BEGIN {warn 4}

# Expand @stack.
$#stack = $stack_depth;
# Save current single-step setting.
$stack[-1] = $single;

# Swing and a miss. Bad syntax.

# Nuke whatever's there.

# De-Perl4-ify the name - ' separators to ::.
$subname =~ s/\'/::/g;

# Line didn't make sense.

# Clever test. If you're a mathematician, it's obvious why this
# test works. If not:

# XXX Okay, what do $frame and $doret do, again?

# XXX It behooves an OS/2 expert to write the necessary documentation for this!

# is it really less, pretending to be more?

# Drop dead.

# I just *know* there are men without -M

# XXX This may be an extraneous variable.

# I may not be able to resurrect you, but here goes ...

# XXX I have no idea what this is doing. Yet.

# Did we find something that makes sense?

# Do not trace this 1; below!

Funny, eh?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Sometimes you get a little loopy after staring at the debugger for a long time (2+ years to write most of that documentation).

    I can't claim credit for the "unreadable code" one though. That was an original, dating back to very close to the debugger's inception.

    I'm glad you noticed. I was wondering if anyone would ever actually look at all that work...
  • Isn't MJD taking a whack at a rewrite of the debugger?
    --
    The great thing about multitasking is that several things can go wrong at once.
    • As far as I know, yes. Don't know how far he's gotten. I think Higher-Order Perl (and being a dad) may have taken up most of his cycles up till now.

      For entertainment, look at DB.pm in any recent Perl distribution. Interesting, innit? Sarathy actually put that together a long time ago, and wrote a proof-of-concept debugger called SWAT that used it. If you're interested, I can track down the SWAT source for you.
    • Somehow obra convinced me to have a go at a new debugger. Devel::ebug [cpan.org] is the result so far. "Devel::ebug is a work in progress."
  • # Yes, go down a level.
    local $level = $level + 1;
  • # The following code may be executed now:
    # BEGIN {warn 4}
    Well, better 4 warned...
    --
    rjbs