dslinux/user/perl/t/lib/MakeMaker/Test/Setup BFD.pm PL_FILES.pm Problem.pm Recurs.pm
cayenne
dslinux_cayenne at user.in-berlin.de
Mon Dec 4 18:01:52 CET 2006
Update of /cvsroot/dslinux/dslinux/user/perl/t/lib/MakeMaker/Test/Setup
In directory antilope:/tmp/cvs-serv17422/t/lib/MakeMaker/Test/Setup
Added Files:
BFD.pm PL_FILES.pm Problem.pm Recurs.pm
Log Message:
Adding fresh perl source to HEAD to branch from
--- NEW FILE: PL_FILES.pm ---
package MakeMaker::Test::Setup::PL_FILES;
@ISA = qw(Exporter);
require Exporter;
@EXPORT = qw(setup teardown);
use strict;
use File::Path;
use File::Basename;
use File::Spec;
use MakeMaker::Test::Utils;
my %Files = (
'PL_FILES-Module/Makefile.PL' => <<'END',
use ExtUtils::MakeMaker;
# A module for testing PL_FILES
WriteMakefile(
NAME => 'PL_FILES::Module',
PL_FILES => { 'single.PL' => 'single.out',
'multi.PL' => [qw(1.out 2.out)],
'Bar_pm.PL' => '$(INST_LIB)/PL/Bar.pm',
}
);
END
'PL_FILES-Module/single.PL' => _gen_pl_files(),
'PL_FILES-Module/multi.PL' => _gen_pl_files(),
'PL_FILES-Module/Bar_pm.PL' => _gen_pm_files(),
'PL_FILES-Module/lib/PL/Foo.pm' => <<'END',
# Module to load to ensure PL_FILES have blib in @INC.
package PL::Foo;
sub bar { 42 }
1;
END
);
sub _gen_pl_files {
my $test = <<'END';
#!/usr/bin/perl -w
# Ensure we have blib in @INC
use PL::Foo;
die unless PL::Foo::bar() == 42;
# Had a bug where PL_FILES weren't sent the file to generate
die "argv empty\n" unless @ARGV;
die "too many in argv: @ARGV\n" unless @ARGV == 1;
my $file = $ARGV[0];
open OUT, ">$file" or die $!;
print OUT "Testing\n";
close OUT
END
$test =~ s/^\n//;
return $test;
}
sub _gen_pm_files {
my $test = <<'END';
#!/usr/bin/perl -w
# Ensure we do NOT have blib in @INC when building a module
eval { require PL::Foo; };
#die $@ unless $@ =~ m{^Can't locate PL/Foo.pm in \@INC };
# Had a bug where PL_FILES weren't sent the file to generate
die "argv empty\n" unless @ARGV;
die "too many in argv: @ARGV\n" unless @ARGV == 1;
my $file = $ARGV[0];
open OUT, ">$file" or die $!;
print OUT "Testing\n";
close OUT
END
$test =~ s/^\n//;
return $test;
}
sub setup {
setup_mm_test_root();
chdir 'MM_TEST_ROOT:[t]' if $^O eq 'VMS';
while(my($file, $text) = each %Files) {
# Convert to a relative, native file path.
$file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
my $dir = dirname($file);
mkpath $dir;
open(FILE, ">$file") || die "Can't create $file: $!";
print FILE $text;
close FILE;
}
return 1;
}
sub teardown {
foreach my $file (keys %Files) {
my $dir = dirname($file);
if( -e $dir ) {
rmtree($dir) || return;
}
}
return 1;
}
--- NEW FILE: Recurs.pm ---
package MakeMaker::Test::Setup::Recurs;
@ISA = qw(Exporter);
require Exporter;
@EXPORT = qw(setup_recurs teardown_recurs);
use strict;
use File::Path;
use File::Basename;
use MakeMaker::Test::Utils;
my %Files = (
'Recurs/Makefile.PL' => <<'END',
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Recurs',
VERSION => 1.00,
);
END
'Recurs/prj2/Makefile.PL' => <<'END',
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Recurs::prj2',
VERSION => 1.00,
);
END
);
sub setup_recurs {
setup_mm_test_root();
chdir 'MM_TEST_ROOT:[t]' if $^O eq 'VMS';
while(my($file, $text) = each %Files) {
# Convert to a relative, native file path.
$file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
my $dir = dirname($file);
mkpath $dir;
open(FILE, ">$file") || die "Can't create $file: $!";
print FILE $text;
close FILE;
}
return 1;
}
sub teardown_recurs {
foreach my $file (keys %Files) {
my $dir = dirname($file);
if( -e $dir ) {
rmtree($dir) || return;
}
}
return 1;
}
1;
--- NEW FILE: Problem.pm ---
package MakeMaker::Test::Setup::Problem;
@ISA = qw(Exporter);
require Exporter;
@EXPORT = qw(setup_recurs teardown_recurs);
use strict;
use File::Path;
use File::Basename;
my %Files = (
'Problem-Module/Makefile.PL' => <<'END',
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Problem::Module',
);
END
'Problem-Module/subdir/Makefile.PL' => <<'END',
printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have";
warn "I think I'm going to be sick\n";
die "YYYAaaaakkk\n";
END
);
sub setup_recurs {
while(my($file, $text) = each %Files) {
# Convert to a relative, native file path.
$file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
my $dir = dirname($file);
mkpath $dir;
open(FILE, ">$file") || die "Can't create $file: $!";
print FILE $text;
close FILE;
}
return 1;
}
sub teardown_recurs {
foreach my $file (keys %Files) {
my $dir = dirname($file);
if( -e $dir ) {
rmtree($dir) || return;
}
}
return 1;
}
1;
--- NEW FILE: BFD.pm ---
package MakeMaker::Test::Setup::BFD;
@ISA = qw(Exporter);
require Exporter;
@EXPORT = qw(setup_recurs teardown_recurs);
use strict;
use File::Path;
use File::Basename;
use MakeMaker::Test::Utils;
my $Is_VMS = $^O eq 'VMS';
my %Files = (
'Big-Dummy/lib/Big/Dummy.pm' => <<'END',
package Big::Dummy;
$VERSION = 0.01;
=head1 NAME
Big::Dummy - Try "our" hot dog's
=cut
1;
END
'Big-Dummy/Makefile.PL' => <<'END',
use ExtUtils::MakeMaker;
# This will interfere with the PREREQ_PRINT tests.
printf "Current package is: %s\n", __PACKAGE__ unless "@ARGV" =~ /PREREQ/;
WriteMakefile(
NAME => 'Big::Dummy',
VERSION_FROM => 'lib/Big/Dummy.pm',
EXE_FILES => [qw(bin/program)],
PREREQ_PM => { strict => 0 },
ABSTRACT_FROM => 'lib/Big/Dummy.pm',
AUTHOR => 'Michael G Schwern <schwern at pobox.com>',
);
END
'Big-Dummy/bin/program' => <<'END',
#!/usr/bin/perl -w
=head1 NAME
program - this is a program
=cut
1;
END
'Big-Dummy/t/compile.t' => <<'END',
print "1..2\n";
print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
print "ok 2 - TEST_VERBOSE\n";
END
'Big-Dummy/Liar/t/sanity.t' => <<'END',
print "1..3\n";
print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
print eval "use Big::Liar; 1;" ? "ok 2\n" : "not ok 2\n";
print "ok 3 - TEST_VERBOSE\n";
END
'Big-Dummy/Liar/lib/Big/Liar.pm' => <<'END',
package Big::Liar;
$VERSION = 0.01;
1;
END
'Big-Dummy/Liar/Makefile.PL' => <<'END',
use ExtUtils::MakeMaker;
my $mm = WriteMakefile(
NAME => 'Big::Liar',
VERSION_FROM => 'lib/Big/Liar.pm',
_KEEP_AFTER_FLUSH => 1
);
print "Big::Liar's vars\n";
foreach my $key (qw(INST_LIB INST_ARCHLIB)) {
print "$key = $mm->{$key}\n";
}
END
);
sub setup_recurs {
setup_mm_test_root();
chdir 'MM_TEST_ROOT:[t]' if $Is_VMS;
while(my($file, $text) = each %Files) {
# Convert to a relative, native file path.
$file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
my $dir = dirname($file);
mkpath $dir;
open(FILE, ">$file") || die "Can't create $file: $!";
print FILE $text;
close FILE;
}
return 1;
}
sub teardown_recurs {
foreach my $file (keys %Files) {
my $dir = dirname($file);
if( -e $dir ) {
rmtree($dir) || return;
}
}
return 1;
}
1;
More information about the dslinux-commit
mailing list