473,804 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why i get different result from command line and browser?(not 500 Err)

hello, the follow code get different result from Command line and
browser
that is to say ,i get the correct result from the command line,but i
cant say the result from browser.

IPC::RUN is used in this code; i get it from
http://ppm.activestate.com/PPMPackag...C-Run-0.77.zip

my environment is:
Microsoft windows 2000 professional
Apache 2.0.49
Active Perl 5.8.3.809

because i am new to perl,i can not solve this.
Please help!thanks a lot.

---------------------------------------------------------------------------
#!C:\perl\bin\p erl.exe -w

use strict;
use IPC::Run qw(start finish) ;
use CGI::Carp qw(fatalsToBrow ser);

print "Content-type: text/html\n\n";

my @cmd = qw(C:\winnt\sys tem32\ping.exe) ;
push(@cmd,'www. google.com');
push(@cmd,'-n');
push(@cmd,'1');

my $h ;
local(*OUT,*ERR );
#this line cannot be modified
$h = start (\@cmd,\"" ,'>pipe', \*OUT, '2>pipe', \*ERR)|| die("can't
write some_file: $!");

print "Result!\n" ;
print "the out is:\n";print <OUT>;
print "the result is err\n"; print <ERR>;
close(OUT);
close(ERR);
finish $h ;
---------------------------------------------------------------------------
Jul 19 '05 #1
7 2525
yzhshi wrote:
hello, the follow code get different result from Command line and
browser
that is to say ,i get the correct result from the command line,but i
cant say the result from browser.


Did you check the answer in the FAQ?
Please see "perldoc -q 500" (althought the question is actually somewhat
different from yours, the answer applies in your case, too).

jue
Jul 19 '05 #2
> Did you check the answer in the FAQ?
Please see "perldoc -q 500" (althought the question is actually somewhat
different from yours, the answer applies in your case, too).

jue


thanks a lot.

Because i am a newer to perl. i read many faq recent although my pool
English...

just now i ran "perldoc -q 500" and read
http://www.perl.org/troubleshooting_CGI.html
but it can't run still.

can you tell me the reasion. thanks again.
from command i can got
-------------------------------------------------
C:\cvsweb>C:\pe rl\bin\perl a1.cgi
Content-type: text/html

Result!
the out is:

Pinging www.google.akadns.net [216.239.53.99] with 32 bytes of data:

Reply from 216.239.53.99: bytes=32 time<10ms TTL=128

Ping statistics for 216.239.53.99:
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
the err is:
-------------------------------------------------

while the browser result is:
-------------------------------------------------
Result! the out is: the err is:
-------------------------------------------------
Jul 19 '05 #3
yzhshi wrote:
Did you check the answer in the FAQ?
Please see "perldoc -q 500" (althought the question is actually
somewhat different from yours, the answer applies in your case, too).

jue


thanks a lot.

Because i am a newer to perl. i read many faq recent although my pool
English...

just now i ran "perldoc -q 500" and read
http://www.perl.org/troubleshooting_CGI.html
but it can't run still.

can you tell me the reasion. thanks again.


If your program runs fine from the command line then you don't have a Perl
problem (there may be some very, very special exceptions).
You may have a problem with CGI, or your web server configuration, or
permissions, or your understanding of how CGI works, or a million of other
issues, none of them related to Perl.

You _really_ should ask in a newsgroup that deals with CGI and web servers
and web authoring and so on, just as suggested in the FAQ. They may be able
to help you.
But because your problem is not related to Perl it is very unlikely that
anyone in a Perl NG can help you.

jue
Jul 19 '05 #4
> You _really_ should ask in a newsgroup that deals with CGI and web servers
and web authoring and so on, just as suggested in the FAQ. They may be able
to help you.


Oh,yes. When I Search for this problem,I found the group
comp.infosystem s.www.authoring.cgi last night,I think I can find the
answer there.
as a newbie of perl,i think I can find the resove way in perl group...
thanks, i will go there an search for that.

but i think i will paste the reason of the question here. for other
newbie just like me ....
Jul 19 '05 #5
yz****@etang.co m (yzhshi) wrote in message news:<f9******* *************** ****@posting.go ogle.com>...
You _really_ should ask in a newsgroup that deals with CGI and web servers
and web authoring and so on, just as suggested in the FAQ. They may be able
to help you.


Oh,yes. When I Search for this problem,I found the group
comp.infosystem s.www.authoring.cgi last night,I think I can find the
answer there.
as a newbie of perl,i think I can find the resove way in perl group...
thanks, i will go there an search for that.

but i think i will paste the reason of the question here. for other
newbie just like me ....


You could use Net::Ping, this will circumvent several problems.

use Net::Ping;
use Time::HiRes qw( gettimeofday tv_interval );

$bytes = 1024;
$timeout = 30;
$pingtype = "icmp";

$ping = Net::Ping->new($pingtyp e , $timeout , $bytes);
while (true) {
if ($ping->ping($ARGV[0],5)) {
$t0 = [gettimeofday];
$elapsed = 1000 * tv_interval( $t0, [gettimeofday]);
print "Pinging $ARGV[0] with $bytes bytes of data rtt=$elapsed mSecs\n"
} else {
print "Host Could Not be Reached\n"
}
Jul 19 '05 #6
yz****@etang.co m (yzhshi) wrote in message news:<f9******* *************** ****@posting.go ogle.com>...
You _really_ should ask in a newsgroup that deals with CGI and web servers
and web authoring and so on, just as suggested in the FAQ. They may be able
to help you.


Oh,yes. When I Search for this problem,I found the group
comp.infosystem s.www.authoring.cgi last night,I think I can find the
answer there.
as a newbie of perl,i think I can find the resove way in perl group...
thanks, i will go there an search for that.

but i think i will paste the reason of the question here. for other
newbie just like me ....


You could use Net::Ping, this will circumvent several problems.

use Net::Ping;
use Time::HiRes qw( gettimeofday tv_interval );

$bytes = 1024;
$timeout = 30;
$pingtype = "icmp";

$ping = Net::Ping->new($pingtyp e , $timeout , $bytes);
while (true) {
if ($ping->ping($ARGV[0],5)) {
$t0 = [gettimeofday];
$elapsed = 1000 * tv_interval( $t0, [gettimeofday]);
print "Pinging $ARGV[0] with $bytes bytes of data rtt=$elapsed mSecs\n"
} else {
print "Host Could Not be Reached\n"
}
Jul 19 '05 #7
ap*******@hotma il.com (Alex939393929) wrote in message
You could use Net::Ping, this will circumvent several problems.


Oh,Thanks,this is only a example to describe this question.
In fact, I am not use ping, I want to use cvsweb in windows and meet this...

I found when I use IPC::RUN3 ,I can get the correct result from browser.

I think I shoud email the author and ask for help
Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4753
by: Shailan | last post by:
Hi Im having trouble with the following code that seems to be behave differently when called from the browser as opposed to the command line. The calling script is a cgi that forks, with the child trying to call another cgi script and pass arguments to it. It works fine from the command line, and calls the required script and passes the arguments correctly. However, when it is run on the browser, it calls the script but does not pass...
2
3640
by: joe | last post by:
hi, after reading some articles and faq, i want to clarify myself what's correct(conform to standard) and what's not? or what should be correct but it isn't simply because compilers don't support. (first i compiled them with g++3.x. ERR means compiler will bark, otherwise it does accept it. Then the Comeau C/C++ 4.3.3 comes)
4
3185
by: lkrubner | last post by:
I'd like to write a PHP script to be used from the command line on a Unix machine. I'd like for the script to put together a string, turn it into a web page, print it, then return control the command line. Obviously it is quite easy to make a string that is valid HTML and send it to the printer. The tough part is making look like a web page. In particular, image tags should print out as images, not image tags. Does anyone have an idea...
3
5716
by: Simone | last post by:
Hello!!! Here is the thing. I have had this problem and I want to address it now where in the next and previous button DoCmd.GoToRecord , , acNext - DoCmd.GoToRecord , , acPrevious I wish the message that displays to the user when there is no more record to got to was something different then **You can't go to the specific record** Has anyone ever changed to say something different?
21
6018
by: Colleyville Alan | last post by:
I am now using the Execute command to run SQL for action queries. When I had them as saved queries, I would use DoCmd.SetWarnings False to allow the queries to overwrite existing tables. when I use this code: CurrentDb().Execute strMySql', dbFailOnError I still get warnings that the table already exists. Is there another command that I am supposed to use?
0
2223
by: taras.di | last post by:
Hi everyone, I've come across an extremely strange problem. The exact same query in both mysql command line client, and mysql query browser gives entirely different results. I was hoping someone out there could shed some light. Ok, the query (I've stripped it bare, the real query is a bit more complex)...
2
13052
by: Chris Song | last post by:
Hello, I'v installed mysql 5.0 (MySQL-server-standard-5.0.27-0.rhel4.i386.rpm) on RedHat AS4. When I start mysql through command line (i.e. /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/tmp/mysql.pid & ), everything is ok. But when I use "service mysql start" command launch it, mysql just quit silently. The log file report is:
1
5197
by: hannahg | last post by:
I am trying to incorparate the win zip command line processor in my code on an Access 2003 database form. The code that I downloaded made a call to the windows api. It requires that you use short names because it works in the command window. The call is to apiGetShortPathName from the kernel. It works great for returning the short name for the xls file I am zipping. But then when I use the same path and name with a zip extension is...
13
4905
by: anil.rita | last post by:
When the user chooses an AV file to play, based upon the type of file, I want to use the default installed media player to play it. I am wondering if this is a good way - any alternatives, suggestions or improvements? if( wmv file) document.write("<OBJECT id=Player classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 height="354" width="479">
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10346
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9173
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.