J
Joey
I am trying to determine the PID when opening of a file handle from within
my main perl code. Here is a snip where i call the open file handle.
$infile = 'infile';
open(IF, "tail -f $infile|") or die "Cannot open pipe $infile\n";
while (<IF>) {
do_smothing()
}
In the example below in unix the main perl code has a pid of perl variable
$$ (PID=18629) then the open file handle has another PID, a child of the
parent (PID = 18630)
% ps -ef| grep tail
user 18632 18455 0 10:42:06 pts/10 0:00 grep tail
user 18630 18629 0 10:42:02 pts/10 0:00 tail -f infile
% ps -ef| grep myscript.pl
user 18634 18455 0 10:42:12 pts/10 0:00 grep myscript.pl
user 18629 18455 0 10:42:02 pts/10 0:00 /usr/bin/perl ./myscript.pl
Is there a way within perl to get the child PID 18630 ?
Thanks in advance.
Joey
my main perl code. Here is a snip where i call the open file handle.
$infile = 'infile';
open(IF, "tail -f $infile|") or die "Cannot open pipe $infile\n";
while (<IF>) {
do_smothing()
}
In the example below in unix the main perl code has a pid of perl variable
$$ (PID=18629) then the open file handle has another PID, a child of the
parent (PID = 18630)
% ps -ef| grep tail
user 18632 18455 0 10:42:06 pts/10 0:00 grep tail
user 18630 18629 0 10:42:02 pts/10 0:00 tail -f infile
% ps -ef| grep myscript.pl
user 18634 18455 0 10:42:12 pts/10 0:00 grep myscript.pl
user 18629 18455 0 10:42:02 pts/10 0:00 /usr/bin/perl ./myscript.pl
Is there a way within perl to get the child PID 18630 ?
Thanks in advance.
Joey