Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Unbelievably Obvious Debugging Tip

by eserte (Deacon)
on Apr 27, 2004 at 14:33 UTC ( #348507=note: print w/ replies, xml ) Need Help??


in reply to Unbelievably Obvious Debugging Tip

I even always use Data::Dumper for debugging output. So I can also spot (invisible) control characters, and I can also dump complex data structures for free. To safe key strokes I use an emacs macro for this:

(defun perl-insert-data-dumper () (interactive) (insert "require Data::Dumper; print STDERR \"Line \" . __LINE__ . \ +", File: \" . __FILE__ . \"\\n\" . Data::Dumper->new([],[])->Indent(1 +)->Useqq(1)->Dump; # XXX\n") (forward-char -40) ) (define-key global-map [C-f12] 'perl-insert-data-dumper)


Comment on Re: Unbelievably Obvious Debugging Tip
Download Code
Replies are listed 'Best First'.
Re: Re: Unbelievably Obvious Debugging Tip
by demerphq (Chancellor) on Apr 27, 2004 at 20:12 UTC

    Allow me to recommend Data::Dump::Streamer instead.

    Yes this blatant advertising. But if you talking about for debugging purposes you might as well use something that gets it right 99.9999% of the time instead of 98% of the time. Oh, and I suspect youll find the output is a lot easier to read. :-)


    ---
    demerphq

      First they ignore you, then they laugh at you, then they fight you, then you win.
      -- Gandhi


Re: Re: Unbelievably Obvious Debugging Tip
by tinita (Parson) on Apr 27, 2004 at 15:08 UTC
    i often use Data::Dumper, too. my macro (vim) is:
    imap ddumper <ESC>gglouse Data::Dumper; $Data::Dumper::Indent = 1; $Da +ta::Dumper::Sortkeys = 1;<ESC>``
    although this is just the use-stuff; maybe i should add a macro for the actual printout.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2015-07-31 08:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (275 votes), past polls