Hello,

Please help me with the following problem: 
I use two simple programs - 
"start.pl", which might be executed from a browser or under shell:

#!/usr/bin/perl -w
open(PID, "< pid") || die "Can't open PID file: $!";
$pid = <PID>;
close PID;
if(defined $pid){
if($pid==0){
print "Location: http://test/flash.html \n\n";
exec '/usr/sites/test/vcgi/server.pl';
}
}

and "server.pl" which is supposed to run under shell

#!/usr/bin/perl -w
use IO::Socket;
open(PID, "> pid") || die "Can't open PID file: $!";
print PID $$ ;
close PID; 

The general idea is that server.pl will manage multiple clients via 
sockets and it writes its PID 
into a file while it's on.
Start.pl will check whether server is on (reading pid file) start 
'server.pl' if necessary 
and then redirect user to a web page which contains a flash based client 
programm.
At the beginnig pid file contains '0'.

The point is if I comment the line 'use IO::Socket;' both programs work 
fine. 
If I use this statement - 'server.pl' fails to work with PID. 

If I run 'start.pl' under shell 'server.pl' works fine in both cases w and 
w/o 'use IO::Socket;'.


Another thing - if I don't use redirect in 'start.pl' and just print 
'hello' 
everything works fine regardless 'use IO::Socket;' in 'server.pl'.

#!/usr/bin/perl -w
open(PID, "< pid") || die "Can't open PID file: $!";
$pid = <PID>;
close PID;
if(defined $pid){
if($pid==0){

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

exec '/usr/sites/test/vcgi/server.pl';
}
}


If anyone has any ideas about why this might happen I'll be appreciated.

-----------
Sergey

Reply via email to