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

Re: I usually debug via...

by gaal (Parson)
on Feb 15, 2005 at 07:34 UTC ( #431051=note: print w/replies, xml ) Need Help??

in reply to I usually debug via...

I'm a printer.

Long ago I put these two lines at the bottom of a script; nowadays I always throw them into my exception handling modules, but push them to main::.

sub ::D { require Data::Dumper; $Data::Dumper::Indent += 0; local $Dat +a::Dumper::Indent = 1; Data::Dumper::Dumper(@_) } sub ::DD { require Carp; Carp::confess(::D(@_)) } # Then from anywhere, use it like this: print ::D({ state => $some_obj }); [...] ::DD($obj) if $bugs_exist;

(The += 0 is just a stupid warning silencer.)

Replies are listed 'Best First'.
Re^2: I usually debug via...
by chime (Friar) on Feb 15, 2005 at 10:23 UTC

    I debug my code with print,
    my mind with alcohol,
    and my dog with flea powder


      So close to a haiku....

      debug code with print
      a mind using alcohol
      dogs with flea powder

      If you are not going to go 95, just avoid our state. Please.
      -Ian Sulam
        But it's still not a haiku (at least to my limited understanding) because it's not about a seasonal event, and his original form, I feel, reads much more poetically. What is with this obsession of things that look similar to haikus? Is it just that they appear easy to create and everyone wants to be a poet?

        Heres one I made earlier on the same theme

        Bug haiku

Re^2: I usually debug via...
by RolandGunslinger (Curate) on Feb 22, 2005 at 15:14 UTC
    print and perl -d for me between these two I get my debugging done oh, and heavy use of Data::Dumper

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2021-03-08 21:35 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (128 votes). Check out past polls.