From: Ben Giddings Date: 2003-07-26T02:18:01+09:00 Subject: Re: Add debug to help info On Fri July 25 2003 5:38 am, Tim Kynerd wrote: > I would also be interested to know what the $DEBUG flag does. While we're on the subject, I hunted around in /usr/lib/ruby/1.6 and found: tk.rb: p 'create_self has no arg' if $DEBUG tempfile.rb: print "done\n" if $DEBUG tcltk.rb: print("mainloop: start\n") if $DEBUG cgi.rb: $stderr.printf("name:%s value:%s\n", name, value) if $DEBUG and: jcode.rb: printf STDERR, "feel free for some warnings:\n" if $VERBOSE net/http.rb: $stderr.puts "WARNING: duplicated HTTP header: #{k}" if $VERBOSE net/http.rb: $stderr.puts 'Content-Type did not set; using application/x-www-form-urlencoded' if $VERBOSE For my own code, I've wrapped debug prints to save keystrokes. Do other people do this, or do you all just append "if $DEBUG" or "if $VERBOSE" to the end of your statements? Is there any interest in a standard Ruby module that does debug prints, debug block runs, and other standard debugging things? Does anybody already have their own that they'd like to share? I like Log4r and use it, but sometimes I'd like something a little simpler and more lightweight. Ben