Tie::Handle(3pm)
π Tie::Handle(3pm) π
okay bestie, welcome to Tie::Handle(3pm) from the Perl Programmers Reference Guide β it's giving base class definitions for tied handles, and we're gonna make it make sense. π
β¨
πΈ NAME πΈ
Tie::Handle β base class definitions for tied handles. slay, that's the whole name section. π«Ά
β¨ SYNOPSIS β¨
here's the vibe in code, fr fr:
package NewHandle;
require Tie::Handle;
@ISA = qw(Tie::Handle);
sub READ { ... } # Provide a needed method
sub TIEHANDLE { ... } # Overrides inherited method
package main;
tie *FH, 'NewHandle';
π DESCRIPTION π
This module hands you some skeletal methods for handle-tying classes. See perltie for the list of functions you need when you're tying a handle to a package. The basic Tie::Handle package provides a new method, plus the methods TIEHANDLE, PRINT, PRINTF, and GETC. iconic. π
If you're a dev who wants to write your own tied-handle classes, the methods are summarized below. The perltie section doesn't only document these β it has sample code too, iykyk. π§
TIEHANDLE classname, LISTβ the method invoked by the commandtie *glob, classname. It associates a new glob instance with the specified class.LISTwould represent additional arguments (along the lines ofAnyDBM_Fileand compatriots) needed to complete the association.WRITE this, scalar, length, offsetβ writeslengthbytes of data fromscalarstarting atoffset.PRINT this, LISTβ prints the values inLIST.PRINTF this, format, LISTβ prints the values inLISTusingformat.READ this, scalar, length, offsetβ readslengthbytes of data intoscalarstarting atoffset.READLINE thisβ reads a single line.GETC thisβ gets a single character.CLOSE thisβ closes the handle.OPEN this, filenameβ (re-)opens the handle.BINMODE thisβ specifies content is binary.EOF thisβ tests for end of file.TELL thisβ returns the position in the file.SEEK this, offset, whenceβ positions the file. Test for end of file.DESTROY thisβ frees the storage associated with the tied handle referenced bythis. This is rarely needed, as Perl manages its memory quite well. But the option exists, should a class wish to perform specific actions upon the destruction of an instance.
π«Ά MORE INFORMATION π«Ά
The perltie section contains an example of tying handles. that's where the example lives. π
π COMPATIBILITY π
This version of Tie::Handle is neither related to nor compatible with the Tie::Handle (3.0) module available on CPAN. It was due to an accident that two modules with the same name appeared. The namespace clash has been cleared in favor of this module that comes with the perl core in September 2000, and accordingly the version number has been bumped up to 4.0. πβ¨
π okay thatβs the whole page, bestie β source/version: perl v5.42.3, date: 2026-11-03, manual: Tie::Handle(3pm). mwah πβ¨
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms