943,946 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Unsolved
  • Views: 4259
  • Perl RSS
Jul 16th, 2007
0

CGI, Tomcat, Perl, not compiling Perl code?

Expand Post »
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)..
Perl Syntax (Toggle Plain Text)
  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 ...
Perl Syntax (Toggle Plain Text)
  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''''''''''''
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nmm32 is offline Offline
2 posts
since Jul 2007
Jul 17th, 2007
0

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

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?
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
KevinADC is offline Offline
898 posts
since Mar 2006
Jul 17th, 2007
1

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

Hi,

take a look at this

kath.
Last edited by katharnakh; Jul 17th, 2007 at 3:00 am.
Reputation Points: 19
Solved Threads: 34
Posting Whiz in Training
katharnakh is offline Offline
237 posts
since Jan 2006
Jul 17th, 2007
0

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

Click to Expand / Collapse  Quote originally posted by katharnakh ...
Hi,

take a look at this

kath.
Thanks!! That helped me to solve the problem.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nmm32 is offline Offline
2 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: Help specifying dynamic lib path
Next Thread in Perl Forum Timeline: How to open HTML page in a browser with specific options selected in drop-down boxes?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC