On Wed, May 12, 2004 at 08:48:07PM +0200, Juerd wrote:
: Some tools like Irssi and my own PLP tie a handle and then select it, to
: intercept the output of normal print statements. But STDOUT can still be
: specified explicitly if that's where you want things to go. 
: 
: This makes the tools compatible with most code out there, for easy
: copying and pasting. (Think of it what you want, but this is and will
: stay the way beginners create their programs.)
: 
: If there is just a default, but no way of changing it, you'd have to tie
: $*OUT itself. But how would one then reach the real stdout, in case it's
: needed?
: 
: I hope I'm missing something :)

Well, yes, you're missing the fact that $*OUT is a variable in Perl 6:

    $*SAVED = $*OUT;
    local($*OUT) = fake_handle();

So you might consider that $*OUT is Perl 6's equivalent to the
currently selected output filehandle.  Note however that, like
select(), the above does not redirect stdout for subprocesses.
It only redirects methods implicitly bound to $*OUT, like C<print>.

Larry

Reply via email to