Benjamin Holzman > pop > POP::Lazy_object

Download:
pop-0.07.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.   Source  

TIECLASS Name: POP::Lazy_object Desc: Implements a tied scalar which holds a persistent object, lazily. When tie() is called, it gets a reference to the syntactical scalar (the one which is being tied into this class), the persistent class name of the object we wish to store, and the pid of that object. The first time the scalar is accessed, we restore the object and then perform some heavy wizardry, untieing the syntactical scalar and setting it to the object we just restored. Ta-da! Now you see it, now you don't... ^

METHOD Name: POP::Lazy_object::TIESCALAR Desc: The tied scalar constructor; takes a reference to the syntactical scalar (the one which is being tied into this class), the persistent class name of the object we wish to store, and the pid of that object.

METHOD Name: POP::Lazy_object::FETCH Desc: Called when the scalar is accessed the first time. Restores the object and then commits harakiri.

METHOD Name: POP::Lazy_object::pid Desc: Used to get at the pid without having to restore the object. Must be called as (tied $foo)->pid;

METHOD Name: POP::Lazy_object::STORE Desc: Just need this for completeness; it'll never get called

syntax highlighting: