in reply to Re^2: batch processing via single open
in thread batch processing via single open
Possible in a way?
OF course yes! That's why I asked about calling semantics. Which part is gathering the collection of files to iterate over? the shell script? do you want perl to gather the files? what system are you on?
<handwaving style="amount: lots"> If you are gathering the file via a shell script, you could do something along these lines
( while read command param; do # whatever method files=`command param` # to gather the files for file in $files; do # process files echo $file done done) | maincode.pl
and in maincode.pl
#!/usr/bin/perl use IPC::Open2; my $cmd = 'whatever'; # really, I have no idea what you are doing $pid = open2(\*CHLD_OUT, \*CHLD_IN, $cmd) or die "oops: $!\n"; while(<STDIN>) { chomp; my $file = $_; # now do whatever with $file. open(I,'<', $file); while (my $line = <I>) { ... # do whatever with each line in the file } }
but since I still don't know what you're up to, I can't give proper advice. See I know what I mean. Why don't you?
Maybe you really want some client/server stuff, or the perl code to act as a stream filter, and dispatch it's output to somewhere else. Each usage has different semantics; how can I know which are required, without a bit more of explanation from you?
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: batch processing via single open
by karden (Novice) on Jul 16, 2007 at 22:35 UTC | |
by shmem (Chancellor) on Jul 17, 2007 at 17:01 UTC | |
by karden (Novice) on Jul 17, 2007 at 17:39 UTC | |
by shmem (Chancellor) on Jul 17, 2007 at 17:52 UTC | |
by karden (Novice) on Jul 18, 2007 at 19:58 UTC |