On Mon, 26 Feb 2001 13:47:12 -0800, Laurie Gennari <[EMAIL PROTECTED]>
wrote:
In the DButils.pm file, add a 1; at the bottom of your module, so it returns a
true value after it's called:
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;
}
# Return a true
1;
>>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
Mike(mickalo)Blezien
========================================
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Tel: 1(225) 686-2002
=========================================