Mail::Action::Storage - manages storage for Mail::Action and descendants


Mail-Action documentation  | view source Contained in the Mail-Action distribution.

Index


NAME

Top

Mail::Action::Storage - manages storage for Mail::Action and descendants

SYNOPSIS

Top

    use base 'Mail::Action::Storage';

DESCRIPTION

Top

Mail::Action::Storage is a parent class for Mail::Action users that need to store data between invocations. You must subclass this module for your own needs. See Mail::SimpleList::Aliases or Mail::TempAddress::Addresses for more ideas.

METHODS

Top

* new( [ $storage_dir ] )

Creates a new Mail::Action::Storage object. The single argument is required; without it, this will throw an exception. $storage_dir should be a directory where to store data files. Beware that in filter mode, relative paths can be terribly ambiguous.

* stored_class()

Returns the name of the class for which this class stores data. For example, Mail::TempAddress::Addresses returns Mail::TempAddress::Address here.

You must override this, as this returns a blank string. It may throw an exception in the future, just to make sure.

* storage_dir()

Returns the storage directory set in the constructor.

* storage_extension()

Returns the extension of the generated address files. By default, this is mas. Note that the leading period is not part of the extension. You'll want to override this.

* storage_file( $name )

Given the name of a file (but not a filename), returns the path and full name of the file as it will be saved on disk. This is an internal method and you probably don't need to override it unless you're doing something quite wacky.

* create()

Creates a new object of the class you're storing. This is an empty method. You must override this in your subclass.

* exists( $name )

Returns whether a stored object of the given name exists.

* save( $object, $name )

Saves a stored object provided as $object with the name given in $name.

* fetch( $name )

Creates and returns a stored object represented by the given name. This will return nothing if the object does not exist.

AUTHOR

Top

chromatic, chromatic@wgz.org, with helpful suggestions from friends, family, and peers.

BUGS

Top

None known.

TODO

Top

No plans. It's pretty nice as it is.

SEE ALSO

Top

Mail::SimpleList::Addresses, Mail::TempAddress::Addresses, and James FitzGibbon's Mail::TempAddress::Addresses::Purgeable for examples of subclassing and extending this class.

COPYRIGHT

Top


Mail-Action documentation  | view source Contained in the Mail-Action distribution.