Vitals:
Apache/1.3.20 (Win32) mod_perl/1.25_01-dev mod_ssl/2.8.4 OpenSSL/0.9.6a on
Windows 2000 with PHP 4.21

I am working on a project that requires me to have two telnet objects per
user session opened, and accessible throughout the user's session. I have
looked at Apache::Session and many other solutions but my problem is that to
keep a Net::Telnet object, I need to keep open sockets and filehandles, so I
cannot serialize the object and store it in a database or file.

Currently I have similar code working flawlessly:
###
# "startup.pl" - called when apache starts (ie. PerlRequire
"d:/Apache/conf/startup.pl")
##
use MySite::Session;

###
# "Session.pm"
##
@EXPORT = qw( %sessionHash );
our %sessionHash;

###
# "init_session.pl" - called IN MOD_PERL when a new session is requested
##
use MySite::Session;
$sessionHash{$session_id . "_telnetObj"} = Net::Telnet->new();

###
# "dostuff.pl" - called IN MOD_PERL many time throughout the session
##
use MySite::Session;
my telnetObj = $sessionHash{$session_id . "_telnetObj"};
bless (\$telnetObj, "Net::Telnet");

Although this is working right now, I don't know enough [ anything? :) ]
about Apache or mod_perl to be sure that this will work in the future. What
I am really concerned about is that the telnetObj will only be accessible
from scripts run by the same child process as that which created and saved
it.

Is there a better way to do this?

Thanks,
Shawn French

Reply via email to