On 04/20/2007 07:29 PM, John Maverick wrote:
Folks,

Got a question regarding perl code in cgi script.

I am running below line of code in cgi script which doesn't work as
expected.

my $ticket = qx{echo $p4pass | p4 login -p $p4user};

Basically command has to return a ticket or error message. I keep getting
$ticket as empty.

However, if I write same code in stand alone perl script, it works fine as
expected. Not sure what is going on.

I looked at other options like open(CMD, "| $cmd") and open3. But, not sure
how to get output from the command.

Any idea what is going wrong here.

Nothing in webserver logs too.

Thanks,
Craig.


I have no idea what p4 is, but perhaps you should make sure it's in the path, e.g.;

print qx(which p4);

Also investigate the value of $?

Alternative ways to send the password to p4 would be to use Expect.pm or IPC::Open3:

perldoc Expect
perldoc IPC::Open3
perldoc perlvar


HTH



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to