Re: [Setup-tool-hackers] xst_file_close
- From: Tambet Ingo <tambet ximian com>
- To: arturo ximian com
- Cc: setup-tool-hackers helixcode com
- Subject: Re: [Setup-tool-hackers] xst_file_close
- Date: 14 Aug 2001 14:22:15 +0200
On 13 Aug 2001 20:26:49 -0400, Arturo Espinosa Aldama wrote:
>
> Perl is bailing out when executing
>
> close $fd;
>
> and $fd eq undef, although the debugger says close undef and $a =
> undef; close $a is legal.
>
> So I changed all close code that is done over a variable (those done over
> a GLOB are OK) to:
>
> &xst_file_close (EXPR);
>
> and I think we should use this simple function from now on.
IMO perl is 100% right if it bails out. It means programmer uses
something like:
$fd = &xst_file_open_write_from_names ($file);
# read data
close $fd;
instead of doing
$fd = &xst_file_open_write_from_names ($file);
if ($fd)
{
# read data
close $fd;
}
I think doing a wrapper around close function is shooting in your own
foot. Without it perl at least warns you that something went wrong so
you can fix it.
Tambet
_______________________________________________
setup-tool-hackers maillist - setup-tool-hackers@ximian.com
http://lists.ximian.com/mailman/listinfo/setup-tool-hackers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]