X-Git-Url: http://git.shiar.net/perl/plp/.git/blobdiff_plain/aaf82199178b7ad9117942bafcb45fadc24e1dab..b5e0ee87251670be18b2f2fc128a4be0b25ebfb8:/lib/PLP/Tie/Print.pm diff --git a/lib/PLP/Tie/Print.pm b/lib/PLP/Tie/Print.pm new file mode 100644 index 0000000..ef537a0 --- /dev/null +++ b/lib/PLP/Tie/Print.pm @@ -0,0 +1,48 @@ +package PLP::Tie::Print; + +use strict; + +=head1 PLP::Tie::Print + +Just prints to stdout, but sends headers if not sent before. + + tie *HANDLE, 'PLP::Tie::Print'; + +This module is part of the PLP Internals and probably not of much use to others. + +=cut + +sub TIEHANDLE { bless \my $dummy, $_[0] } + +sub WRITE { undef } + +sub PRINT { + shift; + return unless grep length, @_; + PLP::sendheaders() unless $PLP::sentheaders; + print STDOUT @_; + select STDOUT; +} + +sub PRINTF { + shift; + return unless length $_[0]; + PLP::sendheaders() unless $PLP::sentheaders; + printf STDOUT @_; + select STDOUT; +} + +sub READ { undef } + +sub READLINE { undef } + +sub GETC { '%' } + +sub CLOSE { undef } + +sub UNTIE { undef } + +sub DESTROY { undef } + +1; +