Skip to Main Content
Perl Pocket Reference, 5th Edition
book

Perl Pocket Reference, 5th Edition

by Johan Vromans
July 2011
Intermediate to advanced content levelIntermediate to advanced
104 pages
2h 14m
English
O'Reilly Media, Inc.
Content preview from Perl Pocket Reference, 5th Edition

Tying Variables

tie var, classname, [ list ]

Ties a variable to a class that will handle it. list is passed to the class constructor.

tied var

Returns a reference to the object underlying var, or undef if var is not tied to a class.

untie var

Breaks the binding between the variable and the class. Calls an UNTIE method if provided.

A class implementing a tied scalar should define the methods TIESCALAR, DESTROY, FETCH, and STORE.

A class implementing a tied ordinary array should define the methods TIEARRAY, CLEAR, DESTROY, EXTEND, FETCHSIZE, FETCH, POP, PUSH, SHIFT, SPLICE, STORESIZE, STORE, and UNSHIFT.

A class implementing a tied hash should define the methods TIEHASH, CLEAR, DELETE, DESTROY, EXISTS, FETCH, FIRSTKEY, NEXTKEY, SCALAR, and STORE.

A class implementing a tied filehandle should define the methods TIEHANDLE, CLOSE, DESTROY, GETC, PRINTF, PRINT, READLINE, READ, and WRITE.

Several base classes to implement tied variables are available in the standard libraries: Tie::Array, Tie::Handle, Tie::Hash, Tie::RefHash, and Tie::Scalar.

perltie.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl Testing: A Developer's Notebook

Perl Testing: A Developer's Notebook

Ian Langworth, Chromatic
Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe

Publisher Resources

ISBN: 9781449311186Errata Page