homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

running perl-cgi scripts using different sessions

 2:17 am on May 27, 2009 (gmt 0)


I have a perl-cgi script that is running fine when one user runs it.

How do i make it run for many users? My basic knowledge tells me that I have to use sessions. But How?

I am mot into web programming. Any basic pointers or sample scripts will be appreciated?



 5:45 am on May 27, 2009 (gmt 0)

this is probably a good starting place to learn about perl sessions:
CGI::Session - persistent session data in CGI applications - search.cpan.org [search.cpan.org]

you really only need sessions if you need to maintain persistent data for each visitor.
typically sessions are maintained by using cookies or a session id parameter, which is what the CGI::Session module will do for you.


 6:00 am on May 27, 2009 (gmt 0)

Below are the some of the details of my script. I am not sure if i need session?

perl-cgi script (hosted on apache server) is running fine when one user runs it through web page. The script is called when user selects some arguments and presses submit button from HTML form using get method. The script inturn calls some batch files using system command and does some other things depending on the arguments selected by user.

Currently if more than one user tries to run the script, the user starting later gets errored out because the system command that runs batch file throws an exit status of 1. But the script before & after system command does run properly. Do I still need sessions? Am I looking into the right direction?
Or is this some other issue?



 10:04 am on May 27, 2009 (gmt 0)

what are the values of the perl special variable $? [perldoc.perl.org] and the perl special variable $! [perldoc.perl.org] after the system call?


 11:03 am on May 30, 2009 (gmt 0)


Thanks for replying.

I was able to figure out the error which was nothing to do with sessions. My system command was something like this:

$res=system("Gtest\\_Bud_.bat >E:\\Temp\\garbage.err");
$res=system("Gtest\\_dump_.bat >E:\\Temp\\garbage.err");

when multiple users were tryng to run different batch files, the issue was with garbage.err file which was getting locked. I have solved the issue by using different names for these garbage.err files for different batch files.

I am planning refine this fix and use session id's for these file names.

But I am stuck with another issue now. If, from a single computer I try to run more than two different batch files by submitting the form more than two times, nothing happens at the third submit (No batch file runs). The browser just hangs, the IE progress bar does not display anything, untill any any one of the batch file's initiated earlier completes. If one of the batch files intitiated earlier takes a lot of time to complete the third submit just times out.

In summary, the perl-cgi script can have only 2 parallel runs, and I think this also means that the script will not support more than 2 users at a time.

Is there some kind of configuration setting in Apache server to let multiple instances of .pl script to run simultaneously?

The form submit code is as below:
<FORM METHOD="GET" action="http://server name/test_cgi.pl" TARGET="_blank">

I am also using the following piece of code at the beginning of the script to prevent the output of the batch run from being displayed on browser:

open(STDERR, "> E:\\Temp\\calcconsole\\output.err");

Any pointers will be appreciated.



 10:35 am on Jun 25, 2009 (gmt 0)

You should test if you can run 3 programs without web server.

Apache has no CGI-specific limits for number of parallel processes.


 9:04 am on Jun 26, 2009 (gmt 0)

maybe there is a limit on concurrent connections to the database or some other resource is maxing out.
have you looked to see of a third process is started for the third script?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved