diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-11-28 17:47:48 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-11-28 17:47:48 +0000 |
commit | 8a0597442b89a0a3330c57701574531c2f5c7b15 (patch) | |
tree | 1fa663b9d95b833cefeeecd81083cb18f90c3afd /pod | |
parent | a1e2a3203e4b30744c9b7c687f0438326033e3c3 (diff) | |
download | perl-8a0597442b89a0a3330c57701574531c2f5c7b15.tar.gz |
update tie() entry in perlfunc to reflect TIEARRAY and TIEHANDLE
p4raw-id: //depot/perl@2359
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlfunc.pod | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 265aad439d..58d372a7b2 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -4145,11 +4145,11 @@ This function binds a variable to a package class that will provide the implementation for the variable. VARIABLE is the name of the variable to be enchanted. CLASSNAME is the name of a class implementing objects of correct type. Any additional arguments are passed to the "C<new()>" -method of the class (meaning C<TIESCALAR>, C<TIEARRAY>, or C<TIEHASH>). -Typically these are arguments such as might be passed to the C<dbm_open()> -function of C. The object returned by the "C<new()>" method is also -returned by the C<tie()> function, which would be useful if you want to -access other methods in CLASSNAME. +method of the class (meaning C<TIESCALAR>, C<TIEHANDLE>, C<TIEARRAY>, +or C<TIEHASH>). Typically these are arguments such as might be passed +to the C<dbm_open()> function of C. The object returned by the "C<new()>" +method is also returned by the C<tie()> function, which would be useful +if you want to access other methods in CLASSNAME. Note that functions such as C<keys()> and C<values()> may return huge lists when used on large objects, like DBM files. You may prefer to use the @@ -4166,28 +4166,52 @@ C<each()> function to iterate over such. Example: A class implementing a hash should have the following methods: TIEHASH classname, LIST - DESTROY this FETCH this, key STORE this, key, value DELETE this, key + CLEAR this EXISTS this, key FIRSTKEY this NEXTKEY this, lastkey + DESTROY this A class implementing an ordinary array should have the following methods: TIEARRAY classname, LIST - DESTROY this FETCH this, key STORE this, key, value - [others TBD] + FETCHSIZE this + STORESIZE this, count + CLEAR this + PUSH this, LIST + POP this + SHIFT this + UNSHIFT this, LIST + SPLICE this, offset, length, LIST + EXTEND this, count + DESTROY this + +A class implementing a file handle should have the following methods: + + TIEHANDLE classname, LIST + READ this, scalar, length, offset + READLINE this + GETC this + WRITE this, scalar, length, offset + PRINT this, LIST + PRINTF this, format, LIST + CLOSE this + DESTROY this A class implementing a scalar should have the following methods: TIESCALAR classname, LIST - DESTROY this FETCH this, STORE this, value + DESTROY this + +Not all methods indicated above need be implemented. See L<perltie>, +L<Tie::Hash>, L<Tie::Array>, L<Tie::Scalar> and L<Tie::Handle>. Unlike C<dbmopen()>, the C<tie()> function will not use or require a module for you--you need to do that explicitly yourself. See L<DB_File> |