Sprog::PrintProxy.3pm

Langue: en

Autres versions - même langue

Version: 2005-05-12 (fedora - 05/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Sprog::PrintProxy - filehandle-like object which proxies prints to another object

SYNOPSIS

   use Sprog::PrintProxy;
 
   my $fh = Sprog::PrintProxy->new($gear);
 
   my $stdout = select $fh;      # remember where STDOUT used to go
 
   print "Test Message\n";       # translated to $gear->print("Test Message\n");
 
   select $stdout;a              # reconnect old STDOUT
 
   print "Test Message\n";       # normal print to STDOUT
 
 

DESCRIPTION

This object intercepts all prints to STDOUT and turns them into "$object->print" where $object is the argument passed to the constructor.

The point of all this silliness is to allow a Perl code snippet executing in a "Sprog::Gear::PerlCode*" gear to call "print" and have the arguments passed to the next downstream gear.

Copyright 2005 Grant McLean <grantm@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.