No kidding! What strange behavior. This must be a rare circumstance,
because I've been running mod_perl and 5.6.1 for some time now.
Perhaps it is only particular versions of mod_perl?
I'll add the patch you suggest, even though passing a bareword FH to a
sub is usually considered a bad thing to do.
Lincoln
Arthur Bergman writes:
> Hi,
>
> After tons of debugging a case when I lost CGI POST variables I
> discovered the following.
>
> In perl 5.6.1, certain operations can cause references to filehandles to
> loose TIE magic even when the filehandle is tied.
>
> Witness.
>
> use strict;
> use IO::Scalar;
> sub IO::Scalar::FILENO {};
> my $scalar = "";
> tie *STDIN, 'IO::Scalar', \$scalar;
> fileno(STDIN);
> my $fh = \*STDIN;
> print $fh "HI";
> print "---$scalar---\n";
>
> Removing the fileno(STDIN), makes the above example work. This is fixed
> in perl 5.8 to be, I don't know how far back it has effect I only tried
> it under 5.6.1.
>
> The result is that if a module does fileno(STDIN), or any of the other
> potential ops (Anyone doing sv_setsv on a glob), any references to STDIN
> will not be tied, however since CGI.pm reads STDIN for post data from a
> reference to STDIN, and mod_perl makes it tied, suddenly post data will
> not appear.
> Worst case it will hang since it does a read( from /dev/null which is
> what plain STDIN is under apache on linux).
>
> The following patch corrects the problem without having any bad side
> effects as far as I know.
>
>
> --- CGI.pm~ Wed Apr 10 21:36:01 2002
> +++ CGI.pm Tue May 14 11:34:22 2002
> @@ -450,7 +450,7 @@
> }
>
> if ($meth eq 'POST') {
> -
> $self->read_from_client(\*STDIN,\$query_string,$content_length,0)
> +
> $self->read_from_client('STDIN',\$query_string,$content_length,0)
> if $content_length > 0;
> # Some people want to have their cake and eat it too!
> # Uncomment this line to have the contents of the query string
>
>
> Arthur
>
--
========================================================================
Lincoln D. Stein Cold Spring Harbor Laboratory
[EMAIL PROTECTED] Cold Spring Harbor, NY
Positions available at my lab: see http://stein.cshl.org/#hire
========================================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]