I'm working on a small Perl-based webapp. I want to create a small include file that all scripts will use. It looks like:

<code>
use CGI;
use DBI();

my $cgi = new CGI;
my $dbh = DBI->connect("DBI:mysql:database=somedb;host=127.0.0.1", "user", "pass");
my $p = $cgi->Vars;
my $uid = $cgi->cookie('uid');
if($uid eq '') {
  print $cgi->header;
  print "<html><script>location.replace('/cgi-bin/login.pl');</script></html>";
}

1;
</code>

In my scripts, I do 'require "./common.pl";' but I get errors when I try to use the variable defined in common.pl. Am I doing something wrong? Am I going about this completely the wrong way?

--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to