perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Förtsch <>
Subject Re: Embperl & STDOUT/IN in mod_perl 2.0.5
Date Fri, 05 Aug 2011 08:59:19 GMT
On Friday, 05 August 2011 09:58:44 wrote:
> Until recently STDOUT etc. were tied filehandles and Embperl XS code
> simply has grabbed the filehandle that was attached with Perl's
> magic.

Since perl 5.8.[12] or so perlio is standard. Since 5.8.6 stdio is 
officially not supported anymore. If perlio is available modperl uses it 
to set up STD handles. Tied handles are only used with stdio.

> This has changed in mod_perl 2.0.4 or 5.

yes, I changed it from something similar to

  open SAVEIN, '<&STDIN';
  open SAVEOUT, '>&STDOUT';
  open STDIN, '<&SAVEIN';
  open STDOUT, '>&SAVEOUT';


    local *STDIN;
    local *STDOUT;

> To save me a lot of investigation (already done some, but with no luck
> so far), can somebody tell me how I get the filehandle that mod_perl
> has setup in my XS code?

The commit in question is 932875. The functions to do the above are 
C<modperl_io_perlio_override_stdhandle()> and 
C<modperl_io_perlio_restore_stdhandle()> in 

They use C<gv_fetchpv("STDIN", GV_ADD, SVt_PVIO);> to get the handle.

Note, all this is only done if the handler is C<perl-script>. For 
C<modperl> handlers STD handles are not set up.

Torsten Förtsch

Need professional modperl support? Hire me! (

Like fantasy?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message