1 package # hide from PAUSE
7 use Path::Class qw/file dir/;
9 _check_author_makefile() unless $ENV{DBICTEST_NO_MAKEFILE_VERIFICATION};
11 # Die if the author did not update his makefile
13 # This is pretty heavy handed, so the check is pretty solid:
15 # 1) Assume that this particular module is loaded from -I <$root>/t/lib
16 # 2) Make sure <$root>/Makefile.PL exists
17 # 3) Make sure we can stat() <$root>/Makefile.PL
19 # If all of the above is satisfied
21 # *) die if <$root>/inc does not exist
22 # *) die if no stat() results for <$root>/Makefile (covers no Makefile)
23 # *) die if Makefile.PL mtime > Makefile mtime
25 sub _check_author_makefile {
27 my $root = _find_co_root()
30 # not using file->stat as it invokes File::stat which in turn breaks stat(_)
31 my ($mf_pl_mtime, $mf_mtime) = ( map
32 { (stat ($root->file ($_)) )[9] }
33 qw/Makefile.PL Makefile/
36 return unless $mf_pl_mtime; # something went wrong during co_root detection ?
39 not -d $root->subdir ('inc')
43 $mf_mtime < $mf_pl_mtime
50 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
51 ======================== FATAL ERROR ===========================
52 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
54 We have a number of reasons to believe that this is a development
55 checkout and that you, the user, did not run `perl Makefile.PL`
56 before using this code. You absolutely _must_ perform this step,
57 and ensure you have all required dependencies present. Not doing
58 so often results in a lot of wasted time for other contributors
59 trying to assit you with spurious "its broken!" problems.
61 If you are seeing this message unexpectedly (i.e. you are in fact
62 attempting a regular installation be it through CPAN or manually),
63 please report the situation to either the mailing list or to the
64 irc channel as described in
66 http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class.pm#GETTING_HELP/SUPPORT
78 # Mimic $Module::Install::AUTHOR
81 my $root = _find_co_root()
85 ( not -d $root->subdir ('inc') )
87 ( -e $root->subdir ('inc')->file ($^O eq 'VMS' ? '_author' : '.author') )
91 # Try to determine the root of a checkout/untar if possible
95 my @mod_parts = split /::/, (__PACKAGE__ . '.pm');
96 my $rel_path = join ('/', @mod_parts); # %INC stores paths with / regardless of OS
98 return undef unless ($INC{$rel_path});
100 # a bit convoluted, but what we do here essentially is:
101 # - get the file name of this particular module
102 # - do 'cd ..' as many times as necessary to get to t/lib/../..
104 my $root = dir ($INC{$rel_path});
105 for (1 .. @mod_parts + 2) {
106 $root = $root->parent;
109 return (-f $root->file ('Makefile.PL') )