GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ATTRIBUTE::PERSISTENT (3)

.ds Aq ’

NAME

Attribute::Persistent - Really lazy persistence

CONTENTS

SYNOPSIS



    use Attribute::Persistent;

    my %hash :persistent;
    $hash{counter}++; # Value retained between calls to the program.

    my %hash2 :persistent(SessionTable); # Explicitly provide a filename.



DESCRIPTION

This module provides a way of abstracting away persistence of array and hash variables.

It’s useful for quick hacks when you don’t care about pulling in the right DBM library and calling tie and so on. Its job is to reduce fuss for the lazy programmer at the cost of flexibility.

It uses MLDBM, so you can use complex data structures in your arrays and hashes. It uses AnyDBM_File, so if you really care about which DBM you get, you can modify AnyDBM_File::ISA in a BEGIN block <B>afterB> loading this module.

It works out which DBMs belong to it by taking an md5 sum of the source code. This means that if you change your code, you lose your data. If you like to keep your data while messing about with your code, you need to explicitly give Attribute::Persistent a key, like this:



    BEGIN { $Attribute::Persistent::KEY = "MyProgram"; }
    use Attribute::Persistent; # Order is important.



This uniquely identifies your program, meaning that the module doesn’t have to grub around with $0 and md5 sums.

But hell, it’s not supposed to be this complex. Just use the module and slap :persistent onto your lexicals where appropriate, and it just works. That’s all most people need to care about.

AUTHOR

Originally by Simon Cozens, simon@cpan.org

Maintained by Scott Penrose, scott@cpan.org

LICENSE

Artistic and GPL.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 PERSISTENT (3) 2005-06-25

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.