perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Förtsch <torsten.foert...@gmx.net>
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 richter@ecos.de 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';
  run_response_handler;
  open STDIN, '<&SAVEIN';
  open STDOUT, '>&SAVEOUT';

to

  {
    local *STDIN;
    local *STDOUT;
    run_response_handler;
  }

> 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 
F<src/modules/perl/modperl_io.c>.

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! (http://foertsch.name)

Like fantasy? http://kabatinte.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message