<code> package Skyline;
use Apache::DBI; use Apache::Cookie; use Exporter;
@ISA = ('Exporter'); @EXPORT_OK = ('check_login', 'init_db', '$dbh'); @EXPORT = ('check_login', 'init_db', '$dbh'); our $dbh;
sub check_login {
my %cookies = Apache::Cookie->fetch;
return ($cookies{uid}->value, $cookies{ut}->value, $cookies{sid}->value, $cookies{rnd1}->value);
}
sub init_db {
$dbh = DBI->connect("DBI:mysql:database=skyline;host=192.168.254.25", "root", "linux", {'RaiseError' => 1});
}
1; </code>
In order to test my code, I've written another little test script:
<code> #!/usr/bin/perl
use CGI; use Skyline;
my $cgi = new CGI;
my ($uid, $ut, $sid, $rnd1) = check_login();
print $cgi->header; print "<html><body>sid = $sid, rnd = $rnd1, uid = $uid, ut = $ut</body></html>"; </code>
which give me 'sid = Apache::Cookie=SCALAR(0x872a958), rnd = , uid = Apache::Cookie=SCALAR(0x86b1ce0), ut = Apache::Cookie=SCALAR(0x86c0874)' or a variation with different scalar addresses. What am I doing wrong? I know the cookies exist. I wrote another test script:
<code> #!/usr/bin/perl
use CGI; use Apache::Cookie;
my $cgi = new CGI; my %cookies = Apache::Cookie->fetch;
print $cgi->header; foreach (keys %cookies) { $cval = $cookies{$_}->value; print "$_ = $cval<p>"; } </code>
This outputs all 4 cookies and their values. Anyone have any idea what I'm doing wrong?
-- 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>