NAME MooseX::AutoDestruct - Clear your attributes after a certain time 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 Class::MOP, Moose. AUTHOR Chris Weyl, "" BUGS Please report any bugs or feature requests to "bug-moosex-autodestruct at rt.cpan.org", or through the web interface at . 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 * AnnoCPAN: Annotated CPAN documentation * CPAN Ratings * Search CPAN COPYRIGHT & LICENSE Copyright (c) 2010, Chris Weyl "". This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS OR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA