in reply to Re: How to print called program to stdout
in thread How to print called program to stdout
There are some details that would help make it easier to answer your questions. 1) What is the form of the output from your subprograms? (ie, Do they print to STDOUT or STDERR, or do they just return a value?). 2) How are you calling the subprograms from your main program? (ie, as direct function/method calls, or by system() calls or qx// or ``).
Because if your subprograms are just printing to STDOUT, and you are calling them from your main program via function/method calls, it surprises me that you cannot see their output. But if you are calling a separate process (which your use of "program" rather than "function" or "method" might indicate) using a system() call, then you are going to have to switch to a print `subprogram` paradigm, otherwise the separate process's output will be lost to the system()'s ether.
Update: Specifically, if your mainprogram.pl looks like:
... then i don't see why it wouldn't print.#!perl use warnings; use strict; use MyModuleToBeTested; callSomeFunctionThatPrintsToSTDOUT();
OTOH,
#!perl use warnings; use strict;
...print `runASecondProgram`;
edit: strikeout patently false info and fix typos from the fix. Thanks choroba
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to print called program to stdout
by choroba (Cardinal) on Mar 19, 2016 at 09:49 UTC | |
by pryrt (Abbot) on Mar 19, 2016 at 23:57 UTC |