in reply to using modules

It's complaining because you haven't declared any variables. my'd variables outside of any blocks or subs have a file scope (they're visible to any code in the same file that occurs after them).

Also you've got a misconception about how Exporter works. You need to actually define a subroutine named connectdb, not just have the code sitting in the file. And to have things exported into your namespace you have to use use, not require (the latter doesn't call the package's import method which is what does the twiddling). Read perldoc perlsub and perldoc perlmod.

Replies are listed 'Best First'.
Re: Re: using modules
by maderman (Beadle) on Nov 09, 2001 at 17:35 UTC
    Opps, I do have the sub connect defined, I just didn't type my original post out properly. I have SUBS.pm as:
    sub connectdb { #Open the Oracle database: if (!defined(open(DBINFO, "$base/dbinfo"))) { die "Can't open dbinfo.\n"; } while(defined($line = <DBINFO>)) { chomp($line); push @dbinfo, $line; } close(DBINFO); $dbh = DBI->connect($dbinfo[0],$dbinfo[1],$dbinfo[2],$dbinfo[3], { RaiseError => 1, AutoCommit => 1} ); }