Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Sending PerlIO* to the stack for call_sv()?

by ph713 (Pilgrim)
on Oct 16, 2005 at 14:20 UTC ( [id://500570]=note: print w/replies, xml ) Need Help??


in reply to Re: Sending PerlIO* to the stack for call_sv()?
in thread Sending PerlIO* to the stack for call_sv()?

Doesn't work for PerlIO objects. Compiler throws warning of wrong pointer type, and the perl function ends up receiving "undef" in place of where the PerlIO argument should have been.
  • Comment on Re^2: Sending PerlIO* to the stack for call_sv()?

Replies are listed 'Best First'.
Re^3: Sending PerlIO* to the stack for call_sv()?
by creamygoodness (Curate) on Oct 16, 2005 at 16:26 UTC
    A PerlIO* isn't a scalar, so you can't put it on the stack. FYI, to get a PerlIO* from a filehandle created in Perl, you use...

    PerlIO* outstream = IoOFP( sv_2io(out_fh_ref_sv) ); PerlIO* instream = IoIFP( sv_2io(in_fh_ref_sv) );

    Note that IoOFP and IoIFP are not officially blessed in perlapi, but people are using them in CPAN code, and it's the only way to get the job done.

    As for going the other way, what you're doing looks right to me, but I'm not a guru.

    --
    Marvin Humphrey
    Rectangular Research ― http://www.rectangular.com

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://500570]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found