http://www.perlmonks.org?node_id=316466


in reply to Re: Thoughts on making modules
in thread Thoughts on making modules

I have a tool for that, too. It's ~/bin/newtest:

#!/usr/bin/perl -w use strict; use File::Path; use File::Basename; my $progfile = basename( $0 ); die "$progfile <modname> <test filename>\n" unless @ARGV >= 2; my ($modname, $filename) = @ARGV; my $filepath = dirname( $filename ); mkpath( $filepath ) unless -e $filepath; open my $out, '>', $filename or die "Can't open '$filename': $!"; print $out <<END_HERE; #!/usr/bin/perl -w BEGIN { chdir 't' if -d 't'; use lib '../lib', '../blib/lib'; } use strict; use Test::More 'no_plan'; # tests => 1; my \$module = '$modname'; use_ok( \$module ) or exit; END_HERE

For Some::Module, run newtest Some::Module t/testfile.t.