v3.17 release
[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 { bless \my $dummy, $_[0] }
16
17 sub WRITE { undef }
18
19 sub PRINT {
20     shift;
21     return if @_ == 1 and not length $_[0];
22     PLP::sendheaders() unless $PLP::sentheaders;
23     print STDOUT @_;
24     select STDOUT;
25 }
26
27 sub PRINTF {
28     shift;
29     printf STDOUT @_;
30     select STDOUT;
31 }
32
33 sub READ { undef }
34
35 sub READLINE { undef }
36
37 sub GETC { '%' }
38
39 sub CLOSE { undef }
40
41 sub UNTIE { undef }
42
43 sub DESTROY { undef }
44
45 1;
46