Tassilo von Parseval <[EMAIL PROTECTED]> writes:

> I was experimenting with something like
> 
>     PerlIO *io;
>     char mode[8];
>     PerlIO_intmode2str(O_RDONLY|O_NONBLOCK, mode, NULL);
>     io = PerlIO_fdopen(self->fd, mode);
> 
> but I can't even figure out whether this works because I don't know how
> to turn a PerlIO* thingy into an SV. Actually, I don't know what to do
> with this PerlIO stuff at all. According to perlapio.pod, this is the
> thing to work with when doing I/O from XS. But there is not a single
> indication anywhere how to turn an SV into a PerlIO and vice versa.

The standard perl typemap have this OUTPUT entry for PerlIO:

T_INOUT
        {
            GV *gv = newGVgen("$Package");
            if ( do_open(gv, "+<&", 3, FALSE, 0, 0, $var) )
                sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
            else
                $arg = &PL_sv_undef;
        }

Regards,
Gisle

Reply via email to