hi all,

I've problem with executing an external program in my perl program. I'm trying to 
build an server for managing pop3 accounts to which I can connect for example via php 
sockets.

For server/client enviroment I'm using Net::Server perl module. Everything works all 
right, until I need to run external 'pw' script. Then client connection to my server 
closes without any errors messages.

If I use the same code (specified below) in my simple test file everything works. 

This code is specified in child process of my server, which is created after 
connection to it (in 'process_request' subroutine of Net::Server::Fork module).

Here is the problematic part of code:


        $tmp = "$pw_path useradd";
        $tmp .= " -n " . $username;
        $tmp .= " -q -m -s " . $shell;
        $tmp .= " -h 0";

        if( defined(open(PW,"| $tmp")) ) {      # here client closes the connection    
                print PW $password, "\n";
                close PW or warn "$pw_path exited on $?: $!";
        } else {
                print "$pw_path failure: $! ($?)";
        }
        1;

'pw' script needs some command line arguments defined in variable $tmp which is passed 
to open.
'-h 0' argument make pw to wait for password to be specified on standart input, so I 
need build an pipe to it.

I'm running FreeBSD 4.7 with perl 5.005_03 and Net-Server-0.83.


Pease help me to figure what I have done wrong. 
Thank you.

roman





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to