Hi Stas,
This message may be very much related to the "Apache->print()" thread
with on the mod_perl list, especially if Steve's patch propagates to
mod_perl 2.0 as well.
The question is :
Is using PerlIO really possible with mod_perl 2.0?
It seems that the TIE handle mechanism in mod_perl doesn't let one to
add PerlIO layers.
In Perl 5.8 this either is done either at the time of "open", or with a
"binmode" call afterwards, like such :
binmode STDOUT, ':utf8'; # Won't work under MOD_PERL .
But this 2-parameter invocation won't work when the file handle
is tied with mod_perl. The "utf8" pseudo-layer is just an example.
It won't work with any layer.
Here is a test snippet, which works under CGI, but fails under
ModPerl::PerlRun, where STDOUT is tied.
#----------------------------------------------------------
use utf8; # actually not needed.
binmode(STDOUT); # WORKS.
binmode(STDOUT, ':utf8'); # FAILS under mod_perl 1.99
# send the headers
print "Content-Type=text/plain; charset=UTF-8\n\n";
# send some content.
print "\x{263A} - Hello world!\n";
1;
__END__
#----------------------------------------------------------
The \x{263A} is UNICODE for SMILEY.
It is there to make the test-case do something useful (i.e. smile)
But the test fails regardless, upon the 2-parameter call to binmode.
Running this under ModPerl::PerlRun (either v1.99_08, or v1.99_09, or
the CVS) will give an error that complains of "usage".
Usage Apache::RequestRec->BINMODE(r), .........
It seems that the TIE method "BINMODE" is asserting that it wants no
additional arguments.
Or perhaps, I am missing something here...
The reason that this is very related to the "print" thread is as follows
:
It could perhaps be desirable to have "print" behave like Perl 5.8+
does, but only if full PerlIO support is available.
Otherwise, we could be up for a very unpredictable print behaviour. At
least, now we are able to count on a pretty much binary-clean print...
In any case, it would be very much desirable to have PerlIO working
correctly.
Ayhan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]