#!perl # package buildInput; use strict; use Exporter (); use vars qw(@ISA @EXPORT); BEGIN { @ISA = qw(Exporter); @EXPORT = qw(&getInput); } 1; #----------------------------- sub getInput { use DBI; use strict; # Read the database user name and password from a file # The file must be two lines with user name and password # on separate lines. There must be no blank lines at the # end of the file. my $dbname="b0dau30.fnal.gov"; my $temp; my $user; my $password; open (USERNAME,"test.user") || die "can't open file: $!"; while (defined ($temp = )) { chomp $temp; $user = $temp; $password=; chomp $password; }; close (USERNAME) || die "couldn't close file: $!"; #note how connection specifies Oracle here, msql, mysql or any #other DBI driver will work exactly the same # my ($dbh) = DBI->connect($dbname,$user,$password,'Oracle') || die "Error connecting $DBI::errstr\n"; my $template = shift; my $myfile=$template; my $line; # # now get the unique instances (return list and hash by reference) # my $unique_instance_ref; my $instance_by_instance_ref; ($unique_instance_ref,$instance_by_instance_ref) = doSQLinstances(); my $inst; foreach $inst (@$unique_instance_ref) { if (exists $$instance_by_instance_ref{$inst}) { print "#WARNING: instance $inst is the same as instance $$instance_by_instance_ref{$inst}\n"; } } open(TEMPLATE, $myfile) or die "unable to open $myfile:$!"; while( $line =