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