Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > why i get different result from command line and browser?(not 500 Err)

Reply
Thread Tools

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

 
 
yzhshi
Guest
Posts: n/a
 
      04-05-2004
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\perl.exe -w

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

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

my @cmd = qw(C:\winnt\system32\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 ;
---------------------------------------------------------------------------
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      04-05-2004
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


 
Reply With Quote
 
 
 
 
yzhshi
Guest
Posts: n/a
 
      04-05-2004
> 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:\perl\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:
-------------------------------------------------
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      04-05-2004
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


 
Reply With Quote
 
yzhshi
Guest
Posts: n/a
 
      04-05-2004
> 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.infosystems.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 ....
 
Reply With Quote
 
Alex939393929
Guest
Posts: n/a
 
      04-06-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (yzhshi) wrote in message news:<(E-Mail Removed). 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.infosystems.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:ing, this will circumvent several problems.

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

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

$ping = Net:ing->new($pingtype , $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"
}
 
Reply With Quote
 
Alex939393929
Guest
Posts: n/a
 
      04-06-2004
(E-Mail Removed) (yzhshi) wrote in message news:<(E-Mail Removed). 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.infosystems.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:ing, this will circumvent several problems.

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

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

$ping = Net:ing->new($pingtype , $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"
}
 
Reply With Quote
 
yzhshi
Guest
Posts: n/a
 
      04-16-2004
(E-Mail Removed) (Alex939393929) wrote in message
> You could use Net:ing, 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
 
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
result of os.times() is different with 'time' command Options hiral Python 2 03-16-2010 05:50 AM
[Q] result of os.times() is different with 'time' command kwatch@gmail.com Python 4 02-04-2007 08:29 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
why get different result of a simple code on different compiler? Tao Wang C++ 4 11-09-2005 01:29 PM
1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds Michael Tan Ruby 32 07-21-2005 03:23 PM



Advertisments