Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server?

Reply
Thread Tools

what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server?

 
 
kath
Guest
Posts: n/a
 
      04-09-2007
Hi all,

I have small doubt, the following code works fine in Apache server.
But not completely in Tomcat. Why??
------------------------
#!C:\Perl\bin\perl.exe

# hello.pl

use CGI;
$cgi = new CGI;
print $cgi->header;
printf "Hello world";
system("perl Hi.pl");
------------------------
#!C:\Perl\bin\perl.exe

# hi.pl

print "Hi";
------------------------

When I tried in Tomcat, the script prints only
Hello world

Why?
What's wrong?


kath.

 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      04-09-2007
kath wrote:
> I have small doubt, the following code works fine in Apache server.
> But not completely in Tomcat. Why??


<snip>

Why don't you ask Perl

> system("perl Hi.pl");


system("perl Hi.pl") == 0 or die $!;

and check the server's error log?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
 
J. Gleixner
Guest
Posts: n/a
 
      04-09-2007
kath wrote:
> Hi all,
>
> I have small doubt, the following code works fine in Apache server.
> But not completely in Tomcat. Why??
> ------------------------
> #!C:\Perl\bin\perl.exe
>
> # hello.pl
>
> use CGI;
> $cgi = new CGI;
> print $cgi->header;
> printf "Hello world";
> system("perl Hi.pl");
> ------------------------
> #!C:\Perl\bin\perl.exe
>
> # hi.pl
>
> print "Hi";
> ------------------------
>
> When I tried in Tomcat, the script prints only
> Hello world
>
> Why?
> What's wrong?


perldoc -q "Why can't I get the output of a command with system"
 
Reply With Quote
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      04-09-2007
J. Gleixner wrote:
> kath wrote:
>
>> Hi all,
>>
>> I have small doubt, the following code works fine in Apache server.
>> But not completely in Tomcat. Why??
>> ------------------------
>> #!C:\Perl\bin\perl.exe
>>
>> # hello.pl
>>
>> use CGI;
>> $cgi = new CGI;
>> print $cgi->header;
>> printf "Hello world";
>> system("perl Hi.pl");
>> ------------------------
>> #!C:\Perl\bin\perl.exe
>>
>> # hi.pl
>>
>> print "Hi";
>> ------------------------
>>
>> When I tried in Tomcat, the script prints only
>> Hello world
>>
>> Why?
>> What's wrong?

>
>
> perldoc -q "Why can't I get the output of a command with system"


That's not applicable here, is it?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
J. Gleixner
Guest
Posts: n/a
 
      04-09-2007
Gunnar Hjalmarsson wrote:
> J. Gleixner wrote:
>> kath wrote:
>>
>>> Hi all,
>>>
>>> I have small doubt, the following code works fine in Apache server.
>>> But not completely in Tomcat. Why??
>>> ------------------------
>>> #!C:\Perl\bin\perl.exe
>>>
>>> # hello.pl
>>>
>>> use CGI;
>>> $cgi = new CGI;
>>> print $cgi->header;
>>> printf "Hello world";
>>> system("perl Hi.pl");
>>> ------------------------
>>> #!C:\Perl\bin\perl.exe
>>>
>>> # hi.pl
>>>
>>> print "Hi";
>>> ------------------------
>>>
>>> When I tried in Tomcat, the script prints only
>>> Hello world
>>>
>>> Why?
>>> What's wrong?

>>
>>
>> perldoc -q "Why can't I get the output of a command with system"

>
> That's not applicable here, is it?


Nope.. nevermind.. I missed that 'Hi' was just going to STDOUT, not to a
variable.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tomcat 5.5+ On a Mac, Under Eclipse, Under OS X Edward V. Berard Java 4 04-04-2006 05:14 AM
Calling a Web Service using Axis, from within an Axis Web Service running under Tomcat hocho888 Java 1 04-29-2005 08:26 PM
What am i doing wrong in calling this script? Urgent please. Thank You. Miguel Dias Moura ASP .Net 4 06-22-2004 11:38 PM
[TOMCAT] Tomcat crashes %=zerointeractive.it% Java 1 01-22-2004 12:08 PM
Tomcat running under apache/mod-jk hangs after calling HelloWorld servlet exactly 9 times Java 0 01-18-2004 01:24 PM



Advertisments