How To Avoid a Perl script calling an Another Perl Script
- by rockyurock
Hello,
i am calling a perl script client.pl from a main script to capture the output of client.pl
in @output.
is there anyway to avoid the use of these two files so i can use the output of client.pl in main.pl itself
here is my code....
main.pl
=======
my @output = readpipe("client.pl");
client.pl
=========
#! /usr/bin/perl -w
#use strict;
use Socket;
#initialize host and port
my $host = shift || $FTP_SERVER;
my $port = shift || $CLIENT_PORT;
my $proto = getprotobyname('tcp');
#get the port address
my $iaddr = inet_aton($host);
my $paddr = sockaddr_in($port, $iaddr);
#create the socket, connect to the port
socket(SOCKET, PF_INET, SOCK_STREAM, $proto)or die "socket: $!\n";
connect(SOCKET, $paddr) or die "connect: $!\n";
my $line;
while ($line = )
{
print "$line\n";
}
close SOCKET or die "close: $!";
/rocky..