From: Nexos Date: 2007-03-21T19:45:11+09:00 Subject: Re: Issue with Getopt-declare incorrect parameter specification On 21 mar, 08:30, "gga" wrote: > It seems to work for me with latest 1.22, albeit you should use > $pattern or @pattern. Otherwise pattern is a local variable to the > block. > > require 'rubygems' > require 'Getopt/Declare' > > @pattern = ".*" > args = Getopt::Declare.new(%q% > -p some regexp; defaults to ".*" (explanation) > { > @pattern = regexp > } > %) > > puts "VERSION #{Getopt::Declare::VERSION}" > p args > puts "PATTERN #@pattern" > > > try.rb -p hello > > VERSION 1.22 > -p => "hello" > Unused: > PATTERN .* Thanks for the issue on the variable scope, but the error message appears when you use a more complex argument value than 'hello', i.e. try.rb -p hello works fine but try.rb -p '[a-c].*' gives the error message