Re: $OUTPUT_RECORD_SEPARATOR strikes against LWP

Graham Barr (bodg@tiuk.ti.com)
Fri, 26 Apr 96 12:09:15 BST


Gisle Aas <aas@bergen.sn.no> writes:
>In message <199604251754.TAA02572@anna.in-berlin.de>, Andreas Koenig writes:
>> there must be still a place in libwww, where you print without setting
>> $\ locally to "".
>
>The same problem applies to $, $# and $" I guess.
>
>Perhaps we should start to use syswrite() instead of print in
>libraries :-)

That may not always be possible. For example the user may also be using
the same file descriptor, and unless autoflush is turned on you can
run into serious syncronisation problems if the user uses stdio operations.

>
>There are also places in libwww-perl where I do:
>
>  while (<FILE>) { ... }

Another example of using stdio :-)

>without setting $/ locally to "\n".
>
>I guess we also have worry about somebody setting $* to 1?
>
>Perhaps every library module should start out with these lines:
>
>  local($_);
>  local($/) = "\n";
>  local($#) = "%.20g";
>  local($,) = "";
>  local($\) = "";
>  local($*) = 0;

I intent to add this list to IO::Handle::write :-)

BTW: IO::Handle contains read/wite and write_format methods. This is
so write, which actually calls print, does the exact opposite of read.

>or perhaps we can get perl to treat all these special variables like
>it treats $[?

Sounds reasonable

>I was surprised about this behaviour:  perl -le '$# = 666; print 42'

Not really, it is sort of what I would expect. However

% perl -wle '$# = 666; print 42'
Use of $# is deprecated at -e line 1.

Regards,
Graham.

--
Graham Barr <bodg@tiuk.ti.com>
Texas Instruments Ltd.