Added variable declaration and "use strict" to Build.PL and Makefile.PL.

This commit is contained in:
依瑪貓 2021-02-10 22:50:03 +08:00
parent b47bd2ed50
commit b3bbac6533
2 changed files with 16 additions and 14 deletions

View File

@ -1,11 +1,12 @@
#! /usr/bin/perl -w
use strict;
use Module::Build;
use lib qw(lib);
use DbFramework::Util;
require 't/util.pl';
$catalog_db = 'dbframework_catalog';
%keytypes = (primary => 0, foreign => 1, index => 2);
my $catalog_db = 'dbframework_catalog';
my %keytypes = (primary => 0, foreign => 1, index => 2);
Module::Build->prompt(<<EOF, "");
@ -25,7 +26,7 @@ unless ( -f $config && Module::Build->prompt("$config exists, use it?", "Y") =~
my @drivers = grep eval "require DBD::$_; 1;", qw/mysql mSQL Pg/;
my $drivers = Module::Build->prompt("Enter (space seperated) DBI drivers to test:", join(" ", @drivers));
@drivers = split /\s/,$drivers;
$test_db = 'test';
my $test_db = 'test';
my %driver;
for my $driver ( @drivers ) {
@ -53,10 +54,10 @@ to $db i.e. 'DBI:$driver:[dsn_string]':}, $db);
# create catalog schema
my %sql = %{catalog_schema()};
# default to mysql DDL syntax
$ddl = (exists $sql{$driver}) ? $driver : 'mysql';
$dsn = $driver{$driver}->{$db}->{dsn};
$u = $driver{$driver}->{$db}->{u};
$p = $driver{$driver}->{$db}->{p};
my $ddl = (exists $sql{$driver}) ? $driver : 'mysql';
$dsn = $driver{$driver}->{$db}->{dsn};
my $u = $driver{$driver}->{$db}->{u};
my $p = $driver{$driver}->{$db}->{p};
my $dbh = DbFramework::Util::get_dbh($dsn,$u,$p);
$dbh->{PrintError} = 0;
for my $table ( qw/c_db c_key c_relationship c_table/ ) {

View File

@ -1,13 +1,14 @@
#! /usr/bin/perl -w
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
use strict;
use ExtUtils::MakeMaker;
use lib qw(lib);
use DbFramework::Util;
require 't/util.pl';
$catalog_db = 'dbframework_catalog';
%keytypes = (primary => 0, foreign => 1, index => 2);
my $catalog_db = 'dbframework_catalog';
my %keytypes = (primary => 0, foreign => 1, index => 2);
prompt(<<EOF);
@ -27,7 +28,7 @@ unless ( -f $config && prompt("$config exists, use it?", "Y") =~ /^y/i ) {
my @drivers = grep eval "require DBD::$_; 1;", qw/mysql mSQL Pg/;
my $drivers = prompt("Enter (space seperated) DBI drivers to test:", join(" ", @drivers));
@drivers = split /\s/,$drivers;
$test_db = 'test';
my $test_db = 'test';
my %driver;
for my $driver ( @drivers ) {
@ -55,10 +56,10 @@ to $db i.e. 'DBI:$driver:[dsn_string]':}, $dsn);
# create catalog schema
my %sql = %{catalog_schema()};
# default to mysql DDL syntax
$ddl = (exists $sql{$driver}) ? $driver : 'mysql';
$dsn = $driver{$driver}->{$db}->{dsn};
$u = $driver{$driver}->{$db}->{u};
$p = $driver{$driver}->{$db}->{p};
my $ddl = (exists $sql{$driver}) ? $driver : 'mysql';
$dsn = $driver{$driver}->{$db}->{dsn};
my $u = $driver{$driver}->{$db}->{u};
my $p = $driver{$driver}->{$db}->{p};
my $dbh = DbFramework::Util::get_dbh($dsn,$u,$p);
$dbh->{PrintError} = 0;
for my $table ( qw/c_db c_key c_relationship c_table/ ) {