CGI, Tomcat, Perl, not compiling Perl code?

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2007
Posts: 2
Reputation: nmm32 is an unknown quantity at this point 
Solved Threads: 0
nmm32 nmm32 is offline Offline
Newbie Poster

CGI, Tomcat, Perl, not compiling Perl code?

 
0
  #1
Jul 16th, 2007
I already configured the Tomcat to run CGI, following some steps from several tutorials, but I do not know what is happening that I cannot run any Perl CGI. The browser just tries to download the code file, it is not showing the compiled output.
I have this simple page (taken from a tutorial)..
  1. <HTML>
  2. <HEAD>
  3. <TITLE>Environment Variables
  4. using GET</TITLE>
  5. </HEAD>
  6. <BODY>
  7. <FORM ACTION="./WEB-INF/cgi/exp.cgi"
  8. METHOD="GET">
  9. Press submit for a list of environment variables. <BR>
  10.  
  11. First Name: <input type=
  12. "text" name="fname" size=
  13. 30><p>
  14. Last Name: <input type="text"
  15. name="lname" size=30><p>
  16. <input type="submit">
  17. </form>
  18.  
  19. <FORM>
  20. </BODY>
  21. </HTML>

...and the simple Perl code ...
  1. #! C:\Perl\bin\perl.exe
  2. print
  3. "Content-type: text/plain\n\n";
  4.  
  5. foreach $var (
  6. sort keys %ENV) {
  7. print
  8. "$var=\"$ENV{$var}\"\n";
  9. }
  10.  
  11. @values = split(
  12. /&/,$ENV{'QUERY_STRING'});
  13. foreach $i (@values) {
  14. ($varname, $mydata) = split(
  15. /=/,$i);
  16. print "$varname = $mydata\n";
  17. }


The Java CLASSPATH...
.;C:\Tomcat\server\lib\servlets-ssi.jar;C:\Tomcat\server\lib\servlets-cgi.jar;C:\Tomcat\webapps\ROOT;C:\Tomcat\server\lib\servlet-api.jar;C:\Tomcat\server\lib\jsp-api.jar;C:\Tomcat\server\lib\el-api.jar

PATH...
C:\Perl\site\bin;C:\Perl\bin;C:\Program Files\Java\jdk1.6.0_02\bin

'''''''''''''''Any help is appreciated''''''''''''
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: CGI, Tomcat, Perl, not compiling Perl code?

 
0
  #2
Jul 17th, 2007
I understand that you say you have setup Tomcat to run CGI scripts, but it appears you did not set it up correctly. Since this is really a Tomcat configuration issues maybe asking on a Tomcat forum will get you the info you need.

Does Tomcat use the ubiquitous cgi-bin? Are your scripts in the cgi-bin? Have you tried .cgi and .pl?
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 237
Reputation: katharnakh is an unknown quantity at this point 
Solved Threads: 33
katharnakh's Avatar
katharnakh katharnakh is offline Offline
Posting Whiz in Training

Re: CGI, Tomcat, Perl, not compiling Perl code?

 
1
  #3
Jul 17th, 2007
Hi,

take a look at this

kath.
Last edited by katharnakh; Jul 17th, 2007 at 3:00 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 2
Reputation: nmm32 is an unknown quantity at this point 
Solved Threads: 0
nmm32 nmm32 is offline Offline
Newbie Poster

Re: CGI, Tomcat, Perl, not compiling Perl code?

 
0
  #4
Jul 17th, 2007
Originally Posted by katharnakh View Post
Hi,

take a look at this

kath.
Thanks!! That helped me to solve the problem.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Perl
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC