NAME
Test::Routine::AutoClear - Enables autoclearing attrs in Test::Routines
VERSION
version 0.001
SYNOPSIS
use Test::Routine::AutoClear;
use Test::More;
use File::Tempdir;
has _tempdir => (
is => 'ro',
isa => 'Int',
builder => '_build_tempdir',
lazy => 1,
autoclear => 1,
handles => {
tempdir => 'name',
},
);
sub _build_tempdir {
File::Tempdir->new();
}
And now all the tests that use a tempdir in your test routine will get a fresh Tempdir
DESCRIPTION
When I'm writing tests with Test::Routine I find myself writing code like this all the time:
has counter => (
is => ro,
lazy => 1,
default => 0
lazy => 1,
clearer => 'reset_counter',
);
SEE ALSO
AUTHOR
Piers Cawley <pdcawley@bofh.org.uk>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Piers Cawley.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.