Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: regarding session in CGI

by hanenkamp (Pilgrim)
on Dec 17, 2003 at 14:41 UTC ( [id://315276]=note: print w/replies, xml ) Need Help??


in reply to regarding session in CGI

You're going to have a problem doing this since your CGIs are going to be run each as a separate process. Therefore, between requests, your telnet object is being serialized to disk, but the socket will be closed when the application exists. Therefore, the second request no longer refers to an active socket.

There are a number of work-arounds, though. You could run your scripts inside of mod_perl and save your telnet information in memeory to keep the socket alive between requests. Another solution would be to have a separate process running as a sort of middleware to actually manage the telnet connection and then use IPC to tell the persistent script what to do--a named pipe could work well here.

Replies are listed 'Best First'.
Re: Re: regarding session in CGI
by mnsbb (Initiate) on Dec 17, 2003 at 15:52 UTC
    thanks a lot hanenkamp. I m new to perl and cgi. i m little confused with mod_perl. Hence i beseech u to give me a clear picture of where mod_perl sits in my code, or please refer me some clear documents in gaining knowledge about that. Thanks again. mnsbb

      Actually, mod_perl is just a platform within which you run your code. See http://perl.apache.org/ for details on mod_perl. Essentially, your CGI scripts can be used as is to run inside a special mod_perl handler process. Or you can rewrite your scripts to use mod_perl's handler API directly.

      Thus, you can probably use your code as is within mod_perl (though, you'll still need some modification to cache your telnet connection) or you can rewrite it to use the mod_perl framework directly, if you prefer.

        Hi hanenkemp and barrd, I got it working and now the response time is 2 seconds. Thanks a lot.
      Hi mnsbb,
      Don't worry, you're not alone...
      ...or please refer me some clear documents in gaining knowledge about that...
      I'm looking at them right now which can be found at http://perl.apache.org. I too am struggling a bit with mod_perl but the benefits seem to be worth it in the long run.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://315276]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2025-01-22 10:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (63 votes). Check out past polls.