[EMAIL PROTECTED] wrote:

>Hi Alex,
>
>Is the enum_files() function under your control?  If so, you can make it
>print to the currently-selected Perl filehandle (which may be STDOUT)
>rather than directly to C's stdout descriptor.  Then your select($iostr)
>will have the effect you want.
>
>It looks like the currently-selected handle is stored in PL_defoutgv,
>but I'm not sure if that's "official API" or not.
>
> -Ken
>
Yes, I can modify enum_files and I tried to do as you suggested. To
get a FILE* to
the currently selected filehandle I tried the following, in enum_files():

IO*             io = GvIOp(PL_defoutgv);
PerlIO* ofp = IoOFP(io);
fout = PerlIO_exportFILE(ofp, "w");


And it seems to work, however, somehow this doesn't go along with the
redirection.
I get a segmentation fault if I try to redirect it from the Perl code.
I believe the problem
might be related to the fact that the filehandle I'm selecting refers
to a string. Somehow
that doesn't go along with what I'm trying to do.


Alex

Reply via email to