Permalink
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (27 sloc) 627 Bytes
use strict;
use warnings;
package Test::Routine::xUnitish;
use Test::Routine ();
use Moose::Exporter;
Moose::Exporter->setup_import_methods(
with_meta => [qw{has}],
also => 'Test::Routine',
);
sub init_meta {
my($class, %arg) = @_;
my $meta = Moose::Role->init_meta(%arg);
my $role = $arg{for_class};
Moose::Util::apply_all_roles($role, 'Test::Routine::AutoClear');
return $meta;
}
sub has {
my($meta, $name, %options) = @_;
if (delete $options{auto_clear}) {
push @{$options{traits}}, 'AutoClear'
}
$meta->add_attribute(
$name,
%options,
);
}
1;