On Friday, 05 August 2011 11:51:59 rich...@ecos.de wrote: > [[GR]] I tried this already but I don't know how to convert the result > into something that I can pass to PerlIO_write as first argument. > Also simply using PerlIO_stdout () as first argument doesn't work > (this still goes to the real stdout not the mod_perl one). > > Any hints?
PerlIO *fp; if (!(fp = IoOFP(GvIOn(gv_fetchpv("STDOUT", GV_ADD, SVt_PVIO))))) { # bad handle # check perhaps if IoIFP returns something. If so, the handle is # read-only. To get an fp for reading us IoIFP. } PerlIO_write(fp, ...) This code does not check if STDOUT is tied. For robust code it would also be better to check the result of each macro on the way to fp. For a more complete example how to convert *STDOUT to a PerlIO* refer to pp_print() in pp_hot.c in the perl source code. Please don't think I am an expert on this. I think what I have said is correct according to the code. Unfortunately this piece of perl is quite undocumented. If in doubt ask on p5p. For example perlapi several times explains other functions in terms of gv_fetchpv but never explains gv_fetchpv itself. Torsten Förtsch -- Need professional modperl support? Hire me! (http://foertsch.name) Like fantasy? http://kabatinte.net --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org For additional commands, e-mail: dev-h...@perl.apache.org