in reply to Re: Using IPC::Run
in thread Using IPC::Run

Thanks. That has advanced the ball but I am not at the goal line yet. You cleared up my confusion with respect to arguments and redirection but now I need to better understand how things work. Here is my current code segment:
. . . my @cmd=("/bin/cpio","-ov"); my $h=start(\@cmd,">",$tape,\$in,\$out,\$err); $thisline=readline(FILELIST); while (defined $thisline) { ($thisfile,$thisfilesize)=split(/\t/,$thisline +); $in="$thisfile\n"; print("Dumping $in"); $h->pump || die putmsg("Dieing - $err"); if (length($out)>0) { putmsg($out); } $total+=$thisfilesize; $complete=sprintf("%.2f",($total/$dumpsize)*10 +0); putmsg("$complete%\n"); $thisline=readline(FILELIST); } finish $h; . . .
The script now blocks forever on the 'pump' function. At the same time the harness is always pumpable so if I use 'pump_nb' and test 'pumpable' it goes into an unending loop. Finally, even the first 'pump' execution does not cause 'cpio' to do anything. At this point I don't know if it is 'cpio' that I need to understand better or IPC::Run. Any ideas? The objective is to go through a list of files/directories provided by 'FILELIST' and have 'cpio' write them to tape. After each file dump, output the file/directory name and calculate the percent complete from the file size which was also provided by 'FILELIST'. That means expecting 'cpio' to read a file from STDIN and write the filename to STDOUT when it dumps it. That appears to be the way it works from command line except the entire input must be provided at once. What I expect IPC:Run to do, if I understand it, is to essentially make 'cpio' interactive, programmatically.