On Fri, 13 Aug 2004 17:02:27 -0400, Perrin Harkins <[EMAIL PROTECTED]> wrote:
> > > Now that Perl has lexically scoped filehandles, there isn't any reason
> > > to explicitly call close() in most cases. ;)
> >
> > Tsk, for shame.  Just wait until you forget to call close() after writing to
> > a file... ;)
> 
> That's the point actually -- perl closes it for me when it goes out of
> scope.

Ah, but perl doesn't check the return value! :)

Something tells me you haven't been bitten by this bug yet, but let me save
you the grief.  When, say, your disk fills up and you let that file handle
go out of scope, close() will silently fail when trying to flush the buffers
to disk.

The moral of the story: always call close() explicitly *and check the return
value* when writing to a file.

-John



-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to