From: schuerig@... (Michael Schuerig) Date: 2001-02-04T03:10:03+09:00 Subject: [ruby-talk:10313] Re: Local directory search "server" script Mike Wilson wrote: > -----Original Message----- > From: "Michael Schuerig" > To: "ruby-talk ML" > Date: Sat Feb 03 06:10:02 PST 2001 > Subject: [ruby-talk:10306] Re: Local directory search "server" script > > >Mike Wilson wrote: > > > >> >#! /usr/bin/ruby -w > >> > > >> >require 'cgi' > >> > > >> > > >> >def main > >> > @myname = File.basename($0) > >> > @searchprog = "agrep -clr" > >> > @hits = {} > >> > @totalocc = 0 > >> > > >> > >> ==Possible stupidity disclaimer ;) > >> I've never seen instance variables used in a non-OO program yet, do you do > >> that because you create a main method and you want those visible through > >> the whole file while still being able to define them within your method? I > >> would've expected $myname, etc, but the @ took me by suprise ;) > > > >It's not meant to be clever, it's just the first thing that occurred to > >me... > > > > I just realized that it's possible that you/someone may have thought that > the "stupidity disclaimer" was referring to my opinion of what you were > doing. No, I didn't even think of this. And anyway, I'm a Ruby Nuby and therefore particularly interested in suggestions regarding style. Actually, I changed the instances vars to globals in the meantime. Michael -- Michael Schuerig mailto:schuerig@acm.org http://www.schuerig.de/michael/