On 31 Jul 2002, at 15:13, Patrick Bennett wrote: > Sorry, that won't work. > Even with REQUIRE_ORDER GetoptLong still eats the first non-option it > hits so further processing won't see that argument. That, plus, the > ordering of the arguments isn't always going to be conveniently in the > 'right order.' > > nobu.nokada / softhome.net wrote: > > >So set opts.ordering to GetoptLong::REQUIRE_ORDER, and make new > >GetoptLong instance according to the remained first argument. > > Hi Patrick, I can think of two approaches to your problem: 1) call GetoptLong in the beginning of the program with all possible options, store them in a hash, and pass the hash to the rest of the program 2) write a wrapper around the useage of GetoptLong that preserves ARGV, something like (not tested) def with_ARGV_saved saved_ARGV = ARGV.dup yield ensure ARGV.clear.concat saved_ARGV end Regards, Pit