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('Test::More' => 0 => 0);
27 check_version('Test::Exception' => 0 => 0);
28 check_version('Text::ParseWords' => 0 => 0);
29 check_version('Text::RecordParser' => 0.02 => 0);
30 check_version('XML::Writer' => 0 => 1);
31 check_version('XML::XPath' => 0 => 1);
35 if (@{$missing{'optional'}} + @{$missing{'required'}}) {
36 print "Some components might not work correctly:\n";
38 if ($missing{'required'}) {
39 $count = scalar(@{$missing{'required'}});
40 printf " You are missing %d required module%s: %s\n",
42 $count == 1 ? '' : 's',
43 join ', ', @{$missing{'required'}};
45 if ($missing{'optional'}) {
46 $count = scalar(@{$missing{'optional'}});
47 printf " You are missing %d optional module%s: %s\n",
49 $count == 1 ? '' : 's',
50 join ', ', @{$missing{'optional'}};
57 'NAME' => __PACKAGE__,
58 'VERSION_FROM' => 'lib/SQL/Translator.pm',
60 'bin/sqlt-diagram.pl',
63 'bin/sql_translator.pl',
65 'PREREQ_PM' => \%PREREQ_PM,
67 FILES => '$(DISTVNAME).tar$(SUFFIX)',
71 # ----------------------------------------------------------------------
72 # check_version($module, $version, $optional)
74 # Takes a module name, optional version number, and a flag indicating
75 # whether the module is optional (default is no).
76 # ----------------------------------------------------------------------
78 my ($module, $version, $optional) = @_;
82 $load = "$module $version";
88 $dots = '.' x (36 - length($load));
93 push @{$missing{'optional'}}, $module;
96 push @{$missing{'required'}}, $module;
98 print "$load $dots not found!";
100 print optional('not found!'), "\n";
103 print required('not found!');
108 my $version = ${"$module\::VERSION"};
109 print "$load $dots $version";
110 print $optional ? optional($version) : required($version);
114 $PREREQ_PM{$module} = $version;
117 sub optional { return _message("[optional]", @_) }
118 sub required { return _message("", @_) }
121 my ($message, $version) = @_;
122 my $size = 24 - (length "$version");
123 my $fmt = '%' . $size . 's';
124 sprintf $fmt => $message;