• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Perl .A question for masters?

nag

New Member
while using Perl ,I encountered this problem several times and I cannot find the way to solve it.Check the following code
PHP:
#!/usr bin/perl -w
$|=1;
print "People connected are :\n";
open(testpipe,"who|") or die("Error : $! ");
while(<testpipe>)
{
    print;
}
print "\n\nEnd of list \n\n";
close(testpipe);
Now if the command who is not found in the path then pipe is not attached to the specified output,but it does not give any error message.
While reading I found the reason is that since die() would be executed upon failure of open() function and in this case open() is not failed ,i.e it successfully opened a pipe but the connection between pipe and the command is failed .

So is there any way to check whether testpipe is actually connected to the given output of command???
 
Back
Top