v3.00 release
[perl/plp/.git] / PLP / Tie / Print.pm
diff --git a/PLP/Tie/Print.pm b/PLP/Tie/Print.pm
new file mode 100644 (file)
index 0000000..7563ba5
--- /dev/null
@@ -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;
+