teleron has asked for the wisdom of the Perl Monks concerning the following question:

I am working on a cgi script that retrieves data from a telnet connection using Net::Telnet. The interaction of the cgi/html would be to submit a form value and have the cgi program retrieve the data via telnet and then parse and display the data back to html form. The only problem I am having is the telnet connection is not persistant and i have the overhead of going back through a login process each time. Is there any way to make this connection persistant so that each time the program runs it can find the existing telnet connection and just retrieve the data and not have to log in each time?

Replies are listed 'Best First'.
Re: Persistant connections
by suaveant (Parson) on Sep 14, 2001 at 17:43 UTC
    What I do for a persistant ftp connection with Net::FTP for Web-FTP is I do the login in a cgi, then I fork off a daemon, which opens a unix socket, the cgi then passes back the location of that socket in a cookie or on the url. Successive calls back call a cgi that simple talks to that unix socket, passing data back and forth. It works quite well.

                    - Ant
                    - Some of my best work - Fish Dinner

Re: Persistant connections
by perrin (Chancellor) on Sep 15, 2001 at 00:27 UTC
    If you use a persistent Perl engine like mod_perl, keeping connections persistent is easy. You can just put the connections in global variables.