Dale, Darren,


On Tue, 2006-06-20 at 05:04 +0900, Dale Martenson wrote:
> Philip Rhoades wrote:
> > People,
> > 
> > I usually pipe my data file through my ruby script with:
> > 
> > 	cat parsefile | t1.rb
> > 
> > but some obscure problems have been tricky to find - if I use:
> > 
> > 	ruby -r debug t1.rb
> > 
> > - how do I pipe the parsefile in ?
> > 
> 
> If you redefine $stdin, you can get this to work. Enter the debugger 
> with:
> 
>         ruby -r debug t1.rb
> 
> Now redefine $stdin as:
> 
>         $stdin = IO.popen("cat parsefile")
> 
> You can now start debugging. All input will be read from the result of 
> the IO.popen call.
> 
> --Dale Martenson


Using both this method and:

	ruby -r debug t1.rb < parsefile  (which I had already tried)

do strange things - eg:

[root@prix bin]# ruby -r debug t1.rb
Debug.rb
Emacs support available.

t1.rb:6:require 'ftools'
(rdb:1) $stdin = IO.popen("cat t")
#<IO:0xb7f16708>
(rdb:1) Received: from localhost (HELO localhost.localdomain)
(127.0.0.1)  by prix.pricom.com.au with SMTP; 20 Jun 2006 08:11:43 -0000
t1.rb:6:compile error
t1.rb:6: syntax error, unexpected ':', expecting $end
.
.
similar repeated errors for the rest of the parsefile ('t")


The top of t1.rb looks like:

#!/usr/bin/ruby
#   qmail-pfilter.rb
#   v1.1
#   2006-03-14

require 'ftools'  (line 6)

The first line of the mail item - text file "t" (parsefile) is read in
and then I get the compile/syntax errors - these continue for the whole
of the rest of the text file but I need to be able to step through the
program one line at a time from the parsefile . . 

What is going on?

Thanks,

Phil.
-- 
Philip Rhoades

Pricom Pty Limited  (ACN 003 252 275  ABN 91 003 252 275)
GPO Box 3411
Sydney NSW      2001
Australia
Mobile:  +61:(0)411-185-652
Fax:     +61:(0)2-8221-9599
E-mail:  phil / pricom.com.au