1 package SQL::Translator;
4 use ExtUtils::MakeMaker;
13 print "Checking for required and recommended modules.\n";
14 # Module Name Version Optional?
15 check_version('Class::Base' => 0 => 0);
16 check_version('File::Basename' => 0 => 0);
17 check_version('File::Spec' => 0 => 0);
18 check_version('GD' => 0 => 1);
19 check_version('GraphViz' => 0 => 1);
20 check_version('IO::Dir' => 0 => 0);
21 check_version('IO::File' => 0 => 0);
22 check_version('IO::Scalar' => 0 => 0);
23 check_version('Parse::RecDescent' => 1.94 => 0);
24 check_version('Pod::Usage' => 0 => 0);
25 check_version('Spreadsheet::ParseExcel' => 0 => 1);
26 check_version('Template' => 2.10 => 1);
27 check_version('Test::More' => 0 => 0);
28 check_version('Test::Exception' => 0 => 0);
29 check_version('Test::Differences' => 0 => 0);
30 check_version('Text::ParseWords' => 0 => 0);
31 check_version('Text::RecordParser' => 0.02 => 0);
32 check_version('XML::Writer' => 0 => 1);
33 check_version('XML::XPath' => 1.13 => 1);
34 check_version('YAML' => 0 => 1);
38 if (@{$missing{'optional'}} + @{$missing{'required'}}) {
39 print "Some components might not work correctly:\n";
41 if (@{$missing{'required'}}) {
42 $count = scalar(@{$missing{'required'}});
43 printf " You are missing %d required module%s: %s\n",
45 $count == 1 ? '' : 's',
46 join ', ', @{$missing{'required'}};
48 if (@{$missing{'optional'}}) {
49 $count = scalar(@{$missing{'optional'}});
50 printf " You are missing %d optional module%s: %s\n",
52 $count == 1 ? '' : 's',
53 join ', ', @{$missing{'optional'}};
60 'NAME' => __PACKAGE__,
61 'VERSION_FROM' => 'lib/SQL/Translator.pm',
68 'PREREQ_PM' => \%PREREQ_PM,
70 FILES => '$(DISTVNAME).tar$(SUFFIX)',
74 # ----------------------------------------------------------------------
75 # check_version($module, $version, $optional)
77 # Takes a module name, optional version number, and a flag indicating
78 # whether the module is optional (default is no).
79 # ----------------------------------------------------------------------
81 my ($module, $version, $optional) = @_;
85 $version = sprintf "%.02f", $version;
86 $load = "$module $version";
92 $dots = '.' x (36 - length($load));
97 push @{$missing{'optional'}}, $module;
100 push @{$missing{'required'}}, $module;
102 print "$load $dots not found!";
104 print optional('not found!'), "\n";
107 print required('not found!');
112 my $ver = sprintf "%.02f" => ${"$module\::VERSION"};
113 print "$load $dots $ver";
114 print $optional ? optional($ver) : required($ver);
119 $PREREQ_PM{$module} = $version;
122 sub optional { return _message("[optional]", @_) }
123 sub required { return _message("", @_) }
126 my ($message, $version) = @_;
127 my $size = 24 - (length "$version");
128 my $fmt = '%' . $size . 's';
129 sprintf $fmt => $message;
133 use File::Basename qw(basename);
136 my ($self, $file) = @_;
137 my $bfile = basename($file);
139 return if $bfile =~ /^\.(?:cvs)?ignore$/;
140 return if $bfile =~ /\.swp$/;
142 return $self->SUPER::libscan($file);