Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Saturday January 31, 2004
03:28 PM

Stub files for Test:: modules

[ #17125 ]

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".

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.