Perl Cd Bookshelf [Electronic resources]

نسخه متنی -صفحه : 875/ 265
نمايش فراداده

8.217. Tie::Handle

Provides skeletal methods for handle-tying classes. Tie::Handle provides a new method as backup in case a class has no TIEHANDLE method. (See the perltie manpage for more detailed information and for examples.) To write your own tied-handle classes, use the following methods.

TIEHANDLE

TIEHANDLE classname, list

Constructor. This method is invoked by the command tie *glob, classname. Associates new glob instance with class classname. list represents any additional arguments needed to complete the association.

DESTROY

DESTROY this

Frees storage associated with the tied handle this. Permits class to take some action when an instance is destroyed. Rarely needed.

GETC

GETC this

Gets one character from tied handle this.

PRINT

PRINT this, list

Prints the values in list.

PRINTF

PRINTF this, format, list

Prints the values in list using format.

READ

READ this, scalar, length, offset

Reads length bytes from scalar starting at offset.

READLINE

READLINE this

Reads one line from this.

WRITE

WRITE this, scalar, length, offset

Writes length bytes of data from scalar starting at offset.


8.216. Tie::File8.218. Tie::Hash


Copyright © 2002 O'Reilly & Associates. All rights reserved.