0647f7c10826200f1ab2e3f6aed81f4b9387ac0f
[perl/plp/.git] / PLP / Tie / Print.pm
1 #--------------------#
2  package PLP::Tie::Print;
3 #--------------------#
4 use strict;
5
6 =head1 PLP::Tie::Print
7
8 Just prints to stdout, but sends headers if not sent before.
9
10     tie *HANDLE, 'PLP::Tie::Print';
11
12 =cut
13
14 sub TIEHANDLE {
15     return bless {}, $_[0];
16 }
17
18 sub WRITE { undef; }
19
20 sub PRINT {
21     my ($self, @param) = @_;
22     return if @param == 1 and not length $param[0];
23     PLP::sendheaders() unless $PLP::sentheaders;
24     print STDOUT @param;
25     select STDOUT;
26 }
27
28 sub PRINTF {
29     my ($self, @param) = @_;
30     printf STDOUT @param;
31     select STDOUT;
32 }
33
34 sub READ { undef }
35
36 sub READLINE { undef }
37
38 sub GETC { '%' }
39
40 sub CLOSE { undef }
41
42 sub UNTIE { undef }
43
44 1;
45