Приглашаем посетить
Романтизм (19v-euro-lit.niv.ru)

Reference: tie

PreviousChapter 5
Function Reference
Next
 

tie

tie variable, classname, list

Binds a variable to a package class, classname, that will provide the implementation for the variable. Any additional arguments (list) are passed to the "new" method of the class (meaning TIESCALAR, TIEARRAY, or TIEHASH). Typically these are arguments such as might be passed to the dbm_open(3) function of C, but this is package-dependent. The object returned by the "new" method is also returned by the tie function, which can be useful if you want to access other methods in classname. (The object can also be accessed through the tied function.)

A class implementing a hash should provide the following methods:

TIEHASH $class, LIST
DESTROY $self
FETCH $self, $key
STORE $self, $key, $value
DELETE $self, $key
EXISTS $self, $key
FIRSTKEY $self
NEXTKEY $self, $lastkey
A class implementing an ordinary array should provide the following methods:
TIEARRAY $classname, LIST
DESTROY $self
FETCH $self, $subscript
STORE $self, $subscript, $value
A class implementing a scalar should provide the following methods:
TIESCALAR $classname, LIST
DESTROY $self
FETCH $self, 
STORE $self, $value
Unlike dbmopen, the tie function will not use or require a module for you - you need to do that explicitly yourself.


PreviousHomeNext
Reference: telldirBook IndexReference: tied