
theory at bricolage
Apr 30, 2008, 9:28 AM
Post #1 of 1
(89 views)
Permalink
|
|
[8211] Don't overwrite `modules.db` with nothing! The choice of database
|
|
Revision: 8211 Author: theory Date: 2008-04-30 09:28:50 -0700 (Wed, 30 Apr 2008) ViewCVS: http://viewsvn.bricolage.cc/?rev=8211&view=rev Log Message: ----------- Don't overwrite `modules.db` with nothing! The choice of database is handled elsewhere, so all the processing her was simply unnecessary. Modified Paths: -------------- bricolage/trunk/inst/database.pl Modified: bricolage/trunk/inst/database.pl =================================================================== --- bricolage/trunk/inst/database.pl 2008-04-30 16:03:31 UTC (rev 8210) +++ bricolage/trunk/inst/database.pl 2008-04-30 16:28:50 UTC (rev 8211) @@ -2,16 +2,24 @@ =head1 NAME -database.pl - database selection script to choose database (mysql, postgresql) and -start the appropriate probing script +database.pl - Probes for the selected database server =head1 DESCRIPTION -This script is called during "make" to ask the user to choose between -different databases then start the appropriate probing script. It -accomplishes this by asking the user . Output collected in -"database.db" by the actual probing scripts. +This script is called during C<make> to probe for the selected databse server +by executing the appropriate script, one of: +=over + +=item * inst/dbprobe_Pg.pl + +=item * inst/dbprobe_mysql.pl + +=back + +This script is dependent on the existence of F<required.db> to know which +database has been selected. + =head1 AUTHOR Andrei Arsu <acidburn[at]asynet.ro> @@ -23,38 +31,13 @@ =cut use strict; -use Config; -use FindBin; -use lib "$FindBin::Bin/lib"; -use Bric::Inst qw(:all); use File::Spec::Functions; -use Data::Dumper; our $REQ; do "./required.db" or die "Failed to read required.db : $!"; -set_required_mod(); -run_probe(); -exit(); +my $script = catfile 'inst', "dbprobe_$REQ->{DB_TYPE}.pl"; +# @ARGV might contain "QUIET" +system($^X, $script, @ARGV) + and die "Failed to launch $REQ->{DB_TYPE} probing script $script: $?\n"; -sub run_probe { - my $script = "./inst/dbprobe_$REQ->{DB_TYPE}.pl"; - # @ARGV might contain "QUIET" - system($Config{perlpath}, $script, @ARGV) == 0 - or die "Failed to launch $REQ->{DB_TYPE} probing script $script: $?"; -} - -sub set_required_mod { - our $MOD; - do "./modules.db" or die "Failed to read modules.db : $!"; - - my @MOD; - for my $i (0 .. $#$MOD) { - push @MOD , $MOD->[$i] if !($MOD->[$i]{name}=~/DBD::/); - push @MOD , $MOD->[$i] if $MOD->[$i]{name}=~/DBD::$REQ->{DB_TYPE}/ - } - - open(OUT, ">modules.db") or die "Unable to open modules.db : $!"; - print OUT Data::Dumper->Dump([\@MOD],['MOD']); - close OUT; -}
|