ef537a03a10a6a6bc7739fd87bfc4981d478340d
[perl/plp/.git] / lib / 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 { bless \my $dummy, $_[0] }
16
17 sub WRITE { undef }
18
19 sub PRINT {
20         shift;
21         return unless grep length, @_;
22         PLP::sendheaders() unless $PLP::sentheaders;
23         print STDOUT @_;
24         select STDOUT;
25 }
26
27 sub PRINTF {
28         shift;
29         return unless length $_[0];
30         PLP::sendheaders() unless $PLP::sentheaders;
31         printf STDOUT @_;
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 sub DESTROY { undef }
46
47 1;
48