I am told by this place that I can put my module into a special directory and reference it like so:package sqlsupport; use strict; use DBI; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(); sub connectdb { my $database = shift; my $driver = "mysql"; my $server = "localhost"; my $url = "DBI:$driver:$database:$server"; my $user = "perl\_interpreter"; my $password = "crawdad"; my $dbh = DBI->connect( $url, $user, $password ) or die "connectdb + can't connect to mysql: $!\n"; return $dbh; } sub dosql { my @results = (); my ($dbh,$sqlstatement,$response)= @_; my $sth = $dbh->prepare($sqlstatement); my @row; $sth->execute || die "Could not execute MySQL statement: $sqlstate +ment"; if ($response) { while (@row=$sth->fetchrow_array) { push(@results, [ @row ]); } } $sth->finish(); return @results; } 1;
When I do that, I get no error on the use statements, but perl says it can find either of the subroutines. I have not gone through the whole make, make build, etc. process because I thought that is only necessary if you are inserting the module into the local lib structure. Maybe not, tho.use lib qw(/myPerl/myModules/); use sqlsupport;
Your advice appreciated.
Steve
In reply to Custom module problems by cormanaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |