[perl #37700] [TODO] Changing Default STDOUT/STDERR Filehandles for PIR Code

Allison Randal via RT parrotbug-followup at parrotcode.org
Tue Dec 16 23:40:32 UTC 2008


On Thu Nov 17 08:10:58 2005, jerry.gay at gmail.com wrote:
> On 11/12/05, chromatic <chromatic at wgz.org> wrote:
> > Hi there,
> >
> > I'd like to change where print output and warnings and errors go within
> > a section of PIR code, like you can change them in C and Perl by closing
> > and reopening the file descriptor or localizing the typeglob,
> > respectively.

The simple solution is to add opcodes for 'setstdin', 'setstdout', and
'setstderr' that change the interpreter's stored FileHandle PMCs to a
PMC passed in as an argument. This will not effect any C code that
directly calls the low-level read/write functions instead of using the
Parrot_io_* functions, but then C code should pretty much always use the
Parrot_io_* functions. (Some exceptions to the general rule apply, like
when the code specifically needs to override any user changes to
STD[IN|OUT|ERR]).

Allison


More information about the parrot-dev mailing list