SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from RedHat Other perl-5.004-0.1.i386.rpm

Tie::Hash

Section: Perl Programmers Reference Guide (3)
Updated: perl 5.004, patch 04
Index 

NAME

Tie::Hash, Tie::StdHash - base class definitions for tied hashes 

SYNOPSIS

    package NewHash;    require Tie::Hash;        @ISA = (Tie::Hash);        sub DELETE { ... }          # Provides needed method    sub CLEAR { ... }           # Overrides inherited method            package NewStdHash;    require Tie::Hash;        @ISA = (Tie::StdHash);        # All methods provided by default, define only those needing overrides    sub DELETE { ... }            package main;        tie %new_hash, 'NewHash';    tie %new_std_hash, 'NewStdHash';
 

DESCRIPTION

This module provides some skeletal methods for hash-tying classes. Seethe perltie manpage for a list of the functions required in order to tie a hashto a package. The basic Tie::Hash package provides a new method, as wellas methods TIEHASH, EXISTS and CLEAR. The Tie::StdHash packageprovides most methods required for hashes in the perltie manpage. It inherits fromTie::Hash, and causes tied hashes to behave exactly like standard hashes,allowing for selective overloading of methods. The new method is providedas grandfathering in the case a class forgets to include a TIEHASH method.

For developers wishing to write their own tied hashes, the required methodsare briefly defined below. See the the perltie manpage section for more detaileddescriptive, as well as example code:

TIEHASH classname, LIST
The method invoked by the command tie %hash, classname. Associates a newhash instance with the specified class. LIST would represent additionalarguments (along the lines of the AnyDBM_File manpage and compatriots) needed tocomplete the association.
STORE this, key, value
Store datum value into key for the tied hash this.
FETCH this, key
Retrieve the datum in key for the tied hash this.
FIRSTKEY this
Return the (key, value) pair for the first key in the hash.
NEXTKEY this, lastkey
Return the next (key, value) pair for the hash.
EXISTS this, key
Verify that key exists with the tied hash this.
DELETE this, key
Delete the key key from the tied hash this.
CLEAR this
Clear all values from the tied hash this.
 

CAVEATS

The the perltie manpage documentation includes a method called DESTROY asa necessary method for tied hashes. Neither Tie::Hash nor Tie::StdHashdefine a default for this method. This is a standard for class packages,but may be omitted in favor of a simple default. 

MORE INFORMATION

The packages relating to various DBM-related implemetations (DB_File,NDBM_File, etc.) show examples of general tied hashes, as does thethe Config manpage module. While these do not utilize Tie::Hash, they serve asgood working examples.


 

Index

NAME
SYNOPSIS
DESCRIPTION
CAVEATS
MORE INFORMATION

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector