4 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
7 if ( $ENV{TEST_SIGNATURE} ) {
8 if ( have_module( 'Module::Signature' ) ) {
11 plan skip_all => '$ENV{TEST_SIGNATURE} is set, but Module::Signature not found';
14 plan skip_all => '$ENV{TEST_SIGNATURE} is not set';
17 #########################
21 my $tmp = MBTest->tmpdir;
24 my $dist = DistGen->new( dir => $tmp );
25 $dist->change_build_pl
27 module_name => $dist->name,
33 chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
35 #########################
39 my $mb = Module::Build->new_from_context;
43 eval {$mb->dispatch('distdir')};
45 chdir( $mb->dist_dir ) or die "Can't chdir to '@{[$mb->dist_dir]}': $!";
48 # Make sure the signature actually verifies
49 ok Module::Signature::verify() == Module::Signature::SIGNATURE_OK();
50 chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
54 # Fake out Module::Signature and Module::Build - the first one to
55 # run should be distmeta.
58 local $^W; # Skip 'redefined' warnings
59 local *Module::Signature::sign = sub { push @run_order, 'sign' };
60 local *Module::Build::Base::ACTION_distmeta = sub { push @run_order, 'distmeta' };
61 eval { $mb->dispatch('distdir') };
64 is $run_order[0], 'distmeta';
65 is $run_order[1], 'sign';
68 eval { $mb->dispatch('realclean') };
73 chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";