Ola Lundqvist wrote: > On Sun, Sep 23, 2007 at 11:49:36AM +0000, Julian Mehnle wrote: > > So I think debarchiver should check $! and $@ rather than the result > > of do() ("unless ($t)"), which really says nothing about whether the > > file could be read and compiled successfully, UNLESS you require > > every configuration file to end with a true-valued statement (which > > the debarchiver man-page says nothing about). And I would not make > > such a requirement. Checking $! and $@ should do just fine. > > The problem here is that $! $@ can contain quite different values, as > you noticed... I do not know if perl actually requires the file to end > with a true statement or not. Maybe it does. I have not checked the > documentation for that.
`perldoc -f do` says: | If "do" cannot read the file, it returns undef and sets $! to the error. | If "do" can read the file but cannot compile it, it returns undef and | sets an error message in [EMAIL PROTECTED] If the file is successfully compiled, | "do" returns the value of the last expression evaluated. Thus relying on $! and $@ is officially sanctioned. I think the "check whether do() returns true" idiom is a remnant from old times when Perl didn't know exceptions ($@).
signature.asc
Description: This is a digitally signed message part.