in reply to Re: External program with large amounts of output
in thread External program with large amounts of output
It might also be reasonable to use the operating system to save the output to a file, and then load the file.
% extprog >big.data % myperl big.data
Among other benefits, this lets you replay the output at will, allowing you to tweak the script without too much effort. You could also munge the data file to extract the first n records, as an additonal way of testing.
Finally, you can take all these data files you create in the process of testing and use them for regression testing: when you make a substantial change to your code, all those files will come in handy for verifying that you haven't borken anything.
The code you present seems a little odd to me. I would sooner have written it as
open(CMDREAD, "$program $args |") or die "ERROR in executing $program $args: $!\n"; while (<CMDREAD>){ # do something with $_ } close (CMDREAD);
i.e., lose the else. Sort of flatter, I guess. That, and I only use unless as a statement modfier, not for flow control.
$foo = $bar + 1 unless $moon->phase < 0.2;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re:x2 External program with large amounts of output
by strat (Canon) on Apr 15, 2002 at 15:44 UTC | |
by Bird (Pilgrim) on Apr 15, 2002 at 18:41 UTC |