From: Artur Merke Date: 2004-02-09T10:20:15+09:00 Subject: ARGV Hi, how do I recognize if a ruby file prg.rb was called as a separate program (from the command line) or was just included using require. Testing ARGV for being nil doesn't seem to work ###################################################################### # file= prg.rb ###################################################################### if ARGV print "called from command line" end ###################################################################### # file= prg2.rb ###################################################################### require 'prg.rb' print "now in prg2" ###################################################################### calling %ruby1.6 prg2.rb produces called from command line now in prg2 and NOT just now in prg2 So what's wrong, I thought it would be the "way of least suprise" to test ARGV for being nil in the above situation. Any suggestions? Artur _______________________________________________________________________________ Artur ||| (O-O) _____________________________________________.oo0--(_)--0oo.___________________