My Perl is pretty weak, so I apologize if this is a really dumb question...

I'm trying to move oft-used code chunks into modules, and the first one is
the connection part.

DButils.pm is:

use DBI;

sub dbConnect
{
  my($database) = shift;
  my($passDir)  = shift;

  $command  = "${pass_dir}/." . $database;
  $password = `$command`;

  $dbh = DBI->connect("DBI:Oracle:$database","sys",$password)
              or die("Couldn't connect to $database\n");
  $dbh->{RaiseError} = 1;
  return $dbh;
}

And I'm calling it from my script as:

#!/usr/local/bin/perl -w

use DButils;

DButils->dbConnect("/export/home/oracle","mymachine_mydb");

I keep getting the error:

DButils.pm did not return a true value at ./ltg.pl line 3.
BEGIN failed--compilation aborted at ./ltg.pl line 3.

Could someone point me in the right direction?

ltg

Reply via email to