8 Makes sure that all of the modules that are 'use'd are listed in the
9 Makefile.PL as dependencies. Also as long as we are source filtering,
10 make sure there are no $DB::single statements in the code.
16 eval 'use Module::CoreList';
17 if ($@) { plan skip_all => 'Module::CoreList not installed' }
22 if( -f 'MANIFEST.SKIP' ) {
24 open( SKIP, 'MANIFEST.SKIP' ) or die "Could not open manifest skip file";
32 find( \&wanted, qw/ lib t / );
36 return if $File::Find::dir =~ m!/.git($|/)!;
37 return if $File::Find::name =~ /~$/;
38 return if $File::Find::name =~ /\.(pod|html)$/;
39 return if $skipped{$File::Find::name};
41 # read in the file from disk
44 open( FILE, $filename ) or return;
48 # strip pod, in a really idiotic way. Good enough though
49 $data =~ s/^=(begin|head).+?(^=cut|\Z)//gms;
51 # look for use and use base statements
52 $used{$1}{$File::Find::name}++ while $data =~ /^\s*use\s+([\w:]+)/gm;
53 while ( $data =~ m|^\s*use base qw.([\w\s:]+)|gm ) {
54 $used{$_}{$File::Find::name}++ for split ' ', $1;
56 # look for DB statements while we are here
57 while( $data =~ /^\s*\$DB::single/gm ) {
58 fail( "DB::single statement present in source " . $File::Find::name );
65 ok( open( MAKEFILE, "Makefile.PL" ), "Opened Makefile" );
66 my $data = <MAKEFILE>;
68 while ( $data =~ /^\s*?(?:requires|recommends|).*?([\w:]+)'(?:\s*=>\s*['"]?([\d\.]+)['"]?)?.*?(?:#(.*))?$/gm ) {
70 if ( defined $3 and length $3 ) {
71 $required{$_} = undef for split ' ', $3;
76 for ( sort keys %used ) {
77 my $first_in = Module::CoreList->first_release($_);
78 next if defined $first_in and $first_in <= 5.00803;
79 next if /^(Text::Tradition|inc|t|feature|parent)(::|$)/;
82 ok( exists $required{$_}, "$_ in Makefile.PL" )
83 or diag( "used in ", join ", ", sort keys %{ $used{$_} } );
88 for ( sort keys %required ) {
89 my $first_in = Module::CoreList->first_release( $_, $required{$_} );
90 fail("Required module $_ (v. $required{$_}) is in core since $first_in")
91 if defined $first_in and $first_in <= 5.008003;