On Tue, 2 Mar 2004, Theo Van Dinter wrote: > On Tue, Mar 02, 2004 at 12:13:44AM -0800, Dan Quinlan wrote: > > I think we need to discuss this one on the mailing list. > > > > > theo: in the SA code, do you think we should be doing return code of 0 > > > is error, or 0 is ok? > > > theo: I'm finding some of our code does one and some does the other. > > > theo: we should pick one. > > > ***theo picks 0 means error > > Ok, but I picked 0 means error and 1 means ok as is standard in most > perl modules and the rest of our code. Lets this type of thing work: > > $value = do_a() || do_b() || do_c(); > > I haven't checked all of the code, since I was just doing stuff in the > Bayes section yesterday, but ...
I have a presentation about using return codes. http://axkit.org/docs/presentations/tpc2002/exceptions.pdf Just so you know my opinion. The above turns into: eval { do_a(); do_b(); do_c() }; if ($@) { # process exception } (I put it all on one line to be more equivalent to your || example) It has the benefit that if you *don't* catch it then at least it gets found out about somewhere up the stack. Anyone who tells me that they've never ignored an error return code has probably never used perl's print function. Matt.
