On Fri, 25 Jul 2003 08:43:44 +0000, Robert Cowham wrote:

> Is it just me or is how to debug a ruby script unnecessarily hidden?
> 
> Can I suggest adding to the output of ruby -h something to indicate how to
> debug.
> 
> With 1.68:
> 
> C:\>ruby -h
> Usage: ruby [switches] [--] [programfile] [arguments]
>   -0[octal]       specify record separator (\0, if no argument) -a        
>        autosplit mode with -n or -p (splits $_ into $F) -c             
>   check syntax only
>   -Cdirectory     cd to directory, before executing your script -d        
>        set debugging flags (set $DEBUG to true) -e 'command'    one line
>   of script. Several -e's allowed. Omit
> [programfile]
>   -Fpattern       split() pattern for autosplit (-a) -i[extension]   edit
>   ARGV files in place (make backup if extension
> supplied)
>   -Idirectory     specify $LOAD_PATH directory (may be used more than
> once)
>   -Kkcode         specifies KANJI (Japanese) code-set -l             
>   enable line ending processing -n              assume 'while gets(); ...
>   end' loop around your script -p              assume loop like -n but
>   print line also like sed -rlibrary       require the library, before
>   executing your script -s              enable some switch parsing for
>   switches after script
> name
>   -S              look for the script using PATH environment variable
>   -T[level]       turn on tainting checks -v              print version
>   number, then turn on verbose mode -w              turn warnings on for
>   your script -x[directory]   strip off text before #!ruby line and
>   perhaps cd to
> directory
>   --copyright     print the copyright
>   --version       print the version
> 
> 
> First off, I was confused by the -d option. It seemed to have no effect.
> It then took some searching around to find out that "ruby -rdebug" was
> what I needed.
> 
> Perhaps the output could be modified to:
> 
>   -d              set debugging flags (set $DEBUG to true)
>     	    	    	Note to debug your script use "-rdebug"
> 
> Just out of curiosity, what does setting the $DEBUG flag do??

I'd like to second this. I was trying to debug something last night, and I
had to open up the pickaxe book to see how to actually start the debugger.

I would also be interested to know what the $DEBUG flag does.

-- 
Tim Kynerd  Sundbyberg (sméÔtan i storstan), Sweden  tkynerd / spamcop.net
Sunrise in Stockholm today:  4:20
Sunset in Stockholm today:  21:27
My rail transit photos at http://www.kynerd.nu