[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (no subject)
From: |
Tim Van Holder |
Subject: |
Re: (no subject) |
Date: |
Mon, 17 Sep 2001 22:08:01 +0200 |
> I'd prefer that you change XFile's open to handle this. Would that be
> a problem?
My feeble perl knowledge suggests this should do the trick:
sub open
{
my ($fh) = shift;
my ($file) = @_;
# WARNING: Gross hack: $FH is a typeglob: use its hash slot to store
# the `name' of the file we are opening. See the example with
# io_socket_timeout in IO::Socket for more, and read Graham's
# comment in IO::Handle.
${*$fh}{'autom4te_xfile_file'} = "$file";
if (!$fh->SUPER::open (@_))
{
my $me = basename ($0);
my $file = ${*$fh}{'autom4te_xfile_file'};
croak "$me: cannot open $file: $!\n";
}
binmode $fh->SUPER
if ${*$fh}{'autom4te_xfile_file'} =~ /^\s*>\s*[^-]/;
}
The "\s*[^-]" is there to ensure we don't put stdout in binary mode.
(Note: is $file invalidated after the SUPER::open? If not, then why is
${*$fh}{'autom4te_xfile_file'} used in the error handler?)
- (no subject), Tim Van Holder, 2001/09/16
- Re: (no subject), Akim Demaille, 2001/09/17
- Re: (no subject), Tim Van Holder, 2001/09/17
- Re: (no subject),
Tim Van Holder <=
- Re: (no subject), Akim Demaille, 2001/09/18
- Re: (no subject), Tim Van Holder, 2001/09/18
- Re: (no subject), Akim Demaille, 2001/09/18
- Re: (no subject), Tim Van Holder, 2001/09/18
- Re: binmode, Akim Demaille, 2001/09/19
- Re: binmode, Akim Demaille, 2001/09/19
- Re: binmode, Tim Van Holder, 2001/09/20