8
use English qw( -no_match_vars );
10
use File::Path qw( rmtree );
14
my $dir = untaint_path( cwd . '/t', '$dir' );
15
my $perl = untaint_path( $EXECUTABLE_NAME, '$perl' );
17
qx{ MODULE_STARTER_DIR=$dir $perl ./script/cgiapp-starter --module=Foo --author="Jaldhar H. Vyas" --email=jaldhar\@braincells.com --dir="$dir/Foo" --mb };
19
my @expected_files = (
20
'Foo/lib/Foo.pm', 'Foo/lib/Foo/templates/runmode1.html',
21
'Foo/t/pod-coverage.t', 'Foo/t/pod.t',
22
'Foo/t/test-app.t', 'Foo/t/01-load.t',
23
'Foo/t/perl-critic.t', 'Foo/t/boilerplate.t',
24
'Foo/t/00-signature.t', 'Foo/t/perlcriticrc',
25
'Foo/Build.PL', 'Foo/Changes',
26
'Foo/README', 'Foo/MANIFEST.SKIP',
27
'Foo/MANIFEST', 'Foo/server.pl',
31
foreach my $file (@expected_files) {
32
$got_files{$file} = -1;
38
if ( -f $File::Find::name ) {
39
my $name = $File::Find::name;
40
$name =~ s{^$dir/}{}msx;
41
$got_files{$name} = grep { $_ eq $name } @expected_files;
49
plan tests => ( scalar keys %got_files ) * 2;
51
foreach my $file ( keys %got_files ) {
52
ok( $got_files{$file} > -1, "Missing file $file" );
55
foreach my $file ( keys %got_files ) {
56
ok( $got_files{$file}, "Extra file $file" );
60
my ( $path, $description ) = @_;
61
if ( !( $path =~ m{ (\A[-+@\w./]+\z) }msx ) ) {
62
die "$description is tainted.\n";
68
if ( -d "$dir/Foo" ) {
69
rmtree "$dir/Foo" || die "$OS_ERROR\n";