X-Git-Url: http://git.shiar.nl/perl/plp/.git/blobdiff_plain/b7a10718f1c1e5d0028cd367c337e9f85dc56618..0f5e78a789961923b45cae1a881c655fff9e7283:/PLP/Tie/Print.pm diff --git a/PLP/Tie/Print.pm b/PLP/Tie/Print.pm new file mode 100644 index 0000000..7563ba5 --- /dev/null +++ b/PLP/Tie/Print.pm @@ -0,0 +1,44 @@ +#--------------------# + 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'; + +=cut + +sub TIEHANDLE { + return bless {}, $_[0]; +} + +sub WRITE { undef; } + +sub PRINT { + my ($self, @param) = @_; + PLP::SendHeaders() unless $PLP::sentheaders; + print STDOUT @param; + select STDOUT; +} + +sub PRINTF { + my ($self, @param) = @_; + printf STDOUT @param; + select STDOUT; +} + +sub READ { undef } + +sub READLINE { undef } + +sub GETC { '%' } + +sub CLOSE { undef } + +sub UNTIE { undef } + +1; +