When I wrote Apache::Filter, I decided to implement an honest-to-god full-on
emulation of Perl's filehandle reading routines, and in particular it should
handle $/ properly.  If you want to have a look at that code, perhaps a portion
of it could be integrated into Apache.pm so it would behave correctly.

In Apache::Filter the filehandle is just tied to a scalar that contains the
text in it.  One filter prints to the filehandle, and another can read from it
using any of Perl's built-in filehandle routines.

By the way, won't newlines in the input be escaped into their hex equivalent
anyway?  Will this really work?


[EMAIL PROTECTED] (John S. Evans) wrote:
>I was the guy :)
>
>Strange, because the "Writing Apache Modules..." book explicitly tells you
>that you CAN do this (use <STDIN> to read the post line by line).
>
>Based on my experience, and your snippet below, I'm guessing the book is
>incorrect :)
>
>-jse
>
>
>> From: "Eric L. Brine" <[EMAIL PROTECTED]>
>> Date: Thu, 25 Nov 1999 01:39:44 -0400
>> To: [EMAIL PROTECTED]
>> Subject: <STDIN> reads everything as one line
>> 
>> 
>> A few days ago, someone mentioned doing
>> $scalar = <STDIN>
>> read the whole POSTed data.
>> 
>> I stumbled upon the following in Apache.pm:
>> #shouldn't use <STDIN> anyhow, but we'll be nice
>> sub READLINE { 
>> my $r = shift;
>> my $line; 
>> $r->read($line, $r->header_in('Content-length'));
>> $line;
>> }
>> This snippet is the tied sub which handles line reads from STDIN.
>> Apparently, his problem had nothing to do with $/ as was suggested. I
>> guess he should be using $r to access the POSTed data.
>> 
>> ELB
>> 
>> --
>> Eric L. Brine  |  Chicken: The egg's way of making more eggs.
>> [EMAIL PROTECTED]  |  Do you always hit the nail on the thumb?
>> ICQ# 4629314   |  An optimist thinks thorn bushes have roses.
>> 
>

  -------------------                            -------------------
  Ken Williams                             Last Bastion of Euclidity
  [EMAIL PROTECTED]                            The Math Forum

Reply via email to