I have been thinking a bit about how to create test files automatically, so my scriptdist can automatically create test files for whatever Test::* modules are installed. Some of my test files look the same for every distribution (e.g. pod.t), and I end up copying the file from somewhere else or from the docs. Now I want to automate that.
I am thinking about something like:
my @modules = get_all_Test_modules();
foreach my $module ( @modules )
{
eval "use $module";
next if $@;
if( $module->can( 'stub' ) )
{
my( $stub ) = $module->stub;
my $name =... # something based on the class name
open FILE, "> $name" or...;
print FILE $stub;
close FILE;
}
}
The more I think about it, the more I like the name "stub".
newtest script (Score:1)
I have a script that does something similar, called newtest [perlmonks.org]. I don't use many Test:: modules in every test though.