[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (no subject)
From: |
Akim Demaille |
Subject: |
Re: (no subject) |
Date: |
18 Sep 2001 12:22:08 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
| > 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.
Is it really wrong anyway?
| (Note: is $file invalidated after the SUPER::open? If not, then why is
| ${*$fh}{'autom4te_xfile_file'} used in the error handler?)
I don't remember what motivated that, feel free to make it simpler.
Maybe it's simply the result of moving things around.
- (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, 2001/09/17
- Re: (no subject),
Akim Demaille <=
- 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