Hi,
I want to make an include or Perl Module that will be included (use) into
the top of each perl script on my website. This include/module will make a
connection to a MySQL database. The code is as follows :
<CODE>
package DBI::MySQLConnect;
use strict;
use Exporter();
use Mysql;
my @ISA = qw(Exporter);
my @EXPORT = qw($db $hostname $uid $passwd $dbh);
my $db = 'lld';
my $hostname = 'localhost';
my $uid = 'web';
my $passwd = 'lemon6464';
my $dbh = Mysql->connect($hostname, $db, $uid, $passwd);
my $dbi = 'iin';
my $hostnamei = 'localhost';
my $uidi = 'web';
my $passwdi = 'lemon6464';
my $dbhi = Mysql->connect($hostnamei, $dbi, $uidi, $passwdi);
1;
</CODE>
My question is, why does this code not work, what I mean by this is, does
the line @EXPORT = qw($db $hostname $uid $passwd $dbh) not export the
scalars listed to the main script that has the line, use DBI::MySQLConnect?
I must admit, this is the first time I've tried something like this, so I
might be doing this all wrong.
The main script has the following, but does reports that $dbh is not
defined.
#!perl -w
use strict;
use DBI::MySQLConnect;
Many thanks,
Kevin Smith
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs