Monitor Perl CGI execution

Hi,
   I'm trying to debug a Perl CGI program that is executing in a Tomcat server. The program never respond but just keeps waiting for the server (the browser says "waiting from localhost..."), and the program is rather complex at about 600 lines of code. Is there any way to monitor which part of the code is executing? It's more difficult than plain Perl since it's executing from a CGI server. Thanks in advance!
Envoy2064Asked:
Who is Participating?
 
Adam314Connect With a Mentor Commented:
I'm not familiar with Tomcat...You could have your program print out something at several parts of the code.  This should be returned to your browser so you can see what is going on.
Or you could have your program write to a log file every so often.. you could check the log to see what is going on.
0
 
Envoy2064Author Commented:
Actually, now that I tried executing the Perl script directly from the command line, it prints the HTML code just fine. Do you know why the web browser just won't show the results of the Perl script no matter how long I waited but the command line execution of the script is just fine? Thanks!
0
 
Adam314Commented:
Is the webserver running the script with different permissions than when you run from the command line?
If so, is there anything the script does that requires different permission than the webserver has?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Adam314Commented:
Did you figure out the proglem? What was it?
0
 
Envoy2064Author Commented:
Not yet, but I think the problem is permissions, as you've said. I just still couldn't figure out how to get the Tomcat to open up permissions for Perl executable...despite searching the web for quite a while.
0
 
Adam314Commented:
Would you like help solving that?

If so:
Is this on a unix type system?  What user runs Tomcat?  What other files/directories does your perl program use, and what are the user/group/permissions on those?
0
 
Envoy2064Author Commented:
Hi Adam,
   Sure, any help will be appreciated. This is on a Windows system, running Tomcat 5.8.8. I'm the user running it, with Administrator privileges. The Perl program does a read-only scan of a database and produces a image file (PNG) and a data file on the local hard disk. Maybe it has something to do with where it is executing in the Tomcat server? I tried giving full control in Windows permission to "users" on the folder but it still doesn't work...
0
 
Adam314Commented:
To try to figure out what is causing the problem, try creating a perl program to run in Tomcat that starts very simple.  As long as it works, continue adding features to it until it either stops working, or has all the functionality you need.

eg:
1) Just prints "testing" to the browser

2) Creates a text file on the local hard disk containing the current time, and prints the status to the browser

3) Connects to the database and gets some (any, but probably text) data from it and prints that data to the browser

4) Creates an empty image file on the local drive, and prints the status of this to the browser

5) Does everything
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.