[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: Tue, 18 Sep 2001 15:21:15 +0200

> | The "\s*[^-]" is there to ensure we don't put stdout in binary mode.
> Is it really wrong anyway?

If stdout is in binary mode, you get


as output from 'print "foo\nbar\nbaz\n";'.
Then again, usually output will be redirected, so that shouldn't
normally be a problem.  Does perl have isatty() functionality?  If so,
I could add that test so I only prevent stdout from being made binary
if it is connected to the console.
What the heck, I'll just drop the conditional; I can always add it if
it is found to cause problems.

> I don't remember what motivated that, feel free to make it simpler.
> Maybe it's simply the result of moving things around.

Second draft:

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);
      croak "$me: cannot open $file: $!\n";
  binmode $fh->SUPER;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]