NAME
MooseX::AutoDestruct - Clear your attributes after a certain time
VERSION
version 0.007
SYNOPSIS
package Foo;
use Moose;
use namespace::autoclean;
use MooseX::AutoDestruct;
has foo => (
traits => ['AutoDestruct'],
is => 'ro', isa => 'Str', lazy_build => 1,
ttl => 600, # time, in seconds
);
sub _build_foo { --some expensive operation-- }
DESCRIPTION
MooseX::AutoDestruct is an attribute metaclass trait that causes your attribute value to be cleared after a certain time from when the value has been set.
This trait will work regardless of how the value is populated or if a clearer method has been installed; or if the value is accessed via the installed accessors or by accessing the attribute metaclass itself.
TRAITS APPLIED
No traits are automatically applied to any metaclasses; however, on use'ing this package an 'AutoDestruct' attribute trait becomes available.
USAGE
Apply the AutoDestruct trait to your attribute metaclass (e.g. "traits => ['AutoDestruct']") and supply a ttl value.
Typical usage of this could be for an attribute to store a value that is expensive to calculate, and can be counted on to be valid for a certain amount of time (e.g. caching). Builders are your friends :)
SEE ALSO
AUTHOR
Chris Weyl, <cweyl at alumni.drew.edu>
BUGS
Please report any bugs or feature requests to bug-moosex-autodestruct at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-AutoDestruct.
TODO
Additional testing is required!
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc MooseX::AutoDestruct
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-AutoDestruct
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
AUTHOR
Chris Weyl <cweyl@alumni.drew.edu>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2011 by Chris Weyl.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999