From: Bob X Date: 2002-10-22T08:35:17+09:00 Subject: Re: functional Ruby equiv to this perl snippet "Daniel Berger" wrote in message news:3DB473B8.9454B953@qwest.com... > > > You can do something very similar in Ruby, using "fail" instead of "die". > > For example: > > > > def open_file name > > f = File.open(name) or fail "couldn't open #{name}" > > return f > > end > > > > --Mirian > > Note that this isn't strictly necessary, unless you just want to provide your > own error message. Ruby will die at that point anyway if the file doesn't > exist (and tell you why). No need to test. > > f = File.open("blah") > # Results in this: > # in `open': No such file or directory - "blah" (Errno::ENOENT) > > Regards, > > Dan > I would want to provide my own error message. I did not see the "fail" option...grrrrr.