summaryrefslogtreecommitdiff
path: root/pod/perltie.pod
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>1998-02-27 04:15:04 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1998-02-27 15:34:06 +0000
commit1d603a678689f1e74cf73914a432b2a8d38be470 (patch)
tree33c7de394ba486768d2f28151acdfc70f0df179f /pod/perltie.pod
parentbf99883da2fbc1b4d546abddb96990a37466b881 (diff)
downloadperl-1d603a678689f1e74cf73914a432b2a8d38be470.tar.gz
_60 & _04 - Add WRITE & CLOSE to TIEHANDLE
p4raw-id: //depot/perl@595
Diffstat (limited to 'pod/perltie.pod')
-rw-r--r--pod/perltie.pod24
1 files changed, 21 insertions, 3 deletions
diff --git a/pod/perltie.pod b/pod/perltie.pod
index 79a749e68a..398c3a0d29 100644
--- a/pod/perltie.pod
+++ b/pod/perltie.pod
@@ -620,8 +620,8 @@ use the each() function to iterate over such. Example:
This is partially implemented now.
A class implementing a tied filehandle should define the following
-methods: TIEHANDLE, at least one of PRINT, PRINTF, READLINE, GETC, or READ,
-and possibly DESTROY.
+methods: TIEHANDLE, at least one of PRINT, PRINTF, WRITE, READLINE, GETC,
+READ, and possibly CLOSE and DESTROY.
It is especially useful when perl is embedded in some other program,
where output to STDOUT and STDERR may have to be redirected in some
@@ -641,6 +641,17 @@ hold some internal information.
sub TIEHANDLE { print "<shout>\n"; my $i; bless \$i, shift }
+=item WRITE this, LIST
+
+This method will be called when the handle is written to via the
+C<syswrite> function.
+
+ sub WRITE {
+ $r = shift;
+ my($buf,$len,$offset) = @_;
+ print "WRITE called, \$buf=$buf, \$len=$len, \$offset=$offset";
+ }
+
=item PRINT this, LIST
This method will be triggered every time the tied handle is printed to
@@ -663,7 +674,7 @@ passed to the printf function.
print sprintf($fmt, @_)."\n";
}
-=item READ this LIST
+=item READ this, LIST
This method will be called when the handle is read from via the C<read>
or C<sysread> functions.
@@ -687,6 +698,13 @@ This method will be called when the C<getc> function is called.
sub GETC { print "Don't GETC, Get Perl"; return "a"; }
+=item CLOSE this
+
+This method will be called when the handle is closed via the C<close>
+function.
+
+ sub CLOSE { print "CLOSE called.\n" }
+
=item DESTROY this
As with the other types of ties, this method will be called when the