Hi, I have a problem with Apache::Sesson, I'm using the following code under :
Server Version: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3 mod_perl/1.28 perl-Apache-Session-1.54-439 mysql-4.0.15-9 perl-DBI-1.37-49 perl-Msql-Mysql-modules-1.2219-331 ------ checkin.pl ----- #!/usr/bin/perl use strict; use CGI; use Apache::Session::MySQL; use Apache; my ( $r, $cookie, %session, $html_code, $session_cookie ); $r = Apache->request; $cookie = $r->header_in('Cookie'); $cookie =~ s/SESSION_ID=(\w*)/$1/; tie %session, 'Apache::Session::MySQL', $cookie, { DataSource => 'dbi:mysql:dbn', #these arguments are UserName => 'useracc', #required when using Password => 'pass', #MySQL.pm LockDataSource => 'dbi:mysql:dbn', LockUserName => 'useracc', LockPassword => 'pass' }; $html_code = "<html><body>"; if ( $session{_session_id} eq $cookie ) { # ok session still alive $html_code .= "Welcome back, member!\n"; } else { $session_cookie = "SESSION_ID=$session{_session_id};"; $r->header_out("Set-Cookie" => $session_cookie); $html_code = "Welcome !"; } $html_code .= "</body></html>"; $r->send_http_header("text/html"); $r->print( $html_code ); ------------------------------- the code works well. But if I put the code into a sub block: everything after my ( $r, $cookie ... ) goes to sub checkin { ... } so again ;) ---8<---- use Apache; my ( $r, $cookie, %session, $html_code, $session_cookie ); &checkin; sub checkin { all the code ... } ---&<-- EOF then the browser states in the status line: waiting for 'servername' if I check mysql I got: host:~>mysqladmin proc ... +-----+------+-----------+-----+---------+------+-----------+--------------------------------------------------------------------------+ | Id | User | Host | db | Command | Time | State | Info | +-----+------+-----------+-----+---------+------+-----------+--------------------------------------------------------------------------+ | 563 | user | localhost | dbn | Sleep | 370 | | | | 564 | user | localhost | dbn | Sleep | 370 | | | | 565 | user | localhost | dbn | Query | 367 | User lock | SELECT GET_LOCK('Apache-Session-34c50ba6fcc9dadd7e716e3c2ad9b47b', 3600) | | 567 | user | localhost | | Query | 0 | | show processlist | +-----+------+-----------+-----+---------+------+-----------+--------------------------------------------------------------------------+ host:~> I would like a reusable code so even put in a module, but until it's not working in a sub ... ??? Thanks any help. Levente | Levente Janovszki | Bekes County Library JUST 4 lines 4 U | | e-mail:[EMAIL PROTECTED] | Bekescsaba, Derkovits sor 1. HUNGARY Zip: 5600 | | Linux. Just use it | * The operating system collapsed * | | w/o fear of panic: | * OK Cancel * | -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html