[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#214036: im: imput doesn't work with Perl 5.8.1



On Wed, Oct 22, 2003 at 07:00:48AM +0900, Tatsuya Kinoshita wrote:
[snip]
> I've modified the im pacakge not to use $! as an error indicator.
> 
> I intend to include the following patch in the next release of
> the im package.
[snip]

I notice in your patch that there are no "close $FDESC" statements. I'm
not sure if they appear later down in the code, but it is generally a good
idea to close a file descriptor after use and check for errors there as
well:

	open FDESC, ...
		or die "Error occurred: $!\n"
	while (<FDESC>) {
		...
	}
	close FDESC or die "Error occurred: $! (status $?)\n";

The last line catches errors detected by the while loop (which exits when
<FDESC> returns an undefined value). The check for $? is only necessary if
the open command spawns a subshell; you can omit it if you're only dealing
with files.

HTH,


T

-- 
Democracy: The triumph of popularity over principle. -- C.Bond

Attachment: signature.asc
Description: Digital signature


Reply to: