STDOUT redirection

P

paraagv

Hi have a perl application in on suse64 bit OS, which internally
redirects STDOUT to a $variable
using
This redirects STDOUT to a variable

open OUT ,'>',\$variable
*STDOUT = *OUT

Now when run the tool
e.g ./app <test>.txt > out.txt

The application has two parts
1. returns all text data in the <test> input as is to STDOUT
2. returns function call with return values also to STDOUT

Now what happens is that category 1 collects in out.txt
while category 2 collects in the $variable

my question is why does STDOUT get split into 2 places and how can I
avoid it - I want all to goto the variable

Thanks
Paraag
 
X

xhoster

Hi have a perl application in on suse64 bit OS, which internally
redirects STDOUT to a $variable
using
This redirects STDOUT to a variable

open OUT ,'>',\$variable
*STDOUT = *OUT

Now when run the tool
e.g ./app <test>.txt > out.txt

The application has two parts
1. returns all text data in the <test> input as is to STDOUT

Where is the code that does that?
2. returns function call with return values also to STDOUT

Where is the code that does that?
Now what happens is that category 1 collects in out.txt
while category 2 collects in the $variable

my question is why does STDOUT get split into 2 places and how can I
avoid it - I want all to goto the variable

Without seeing some of the code, it is hard to say. Maybe some of the
printing happens before the redirect takes place. Maybe some of the
printing happens in spawned processes which aren't affected your hacking of
the perl symbol table.

Xho
 
K

Klaus

Hi have a perl application in on suse64 bit OS, which internally
redirects STDOUT to a $variable
using
This redirects STDOUT to a variable

open OUT ,'>',\$variable
*STDOUT = *OUT

Now when run the tool
e.g ./app <test>.txt > out.txt

The application has two parts
1. returns all text data in the <test> input as is to STDOUT
2. returns function call with return values also to STDOUT

Now what happens is that category 1 collects in out.txt
while category 2 collects in the $variable

my question is why does STDOUT get split into 2 places and how can I
avoid it - I want all to goto the variable

I am guessing that your function call has external commands (for
example system(), `...`, qx(), etc...). If that is the case, then the
bad news is that the STDOUT of those external commands will not be
captured by *STDOUT = *OUT

I have never tried it myself, but PerlFaq8: "How can I capture STDERR
from an external command?" might give some ideas.
 
P

paraagv

I am guessing that your function call has external commands (for
example system(), `...`, qx(), etc...). If that is the case, then the
bad news is that the STDOUT of those external commands will not be
captured by *STDOUT = *OUT

I have never tried it myself, but PerlFaq8: "How can I capture STDERR
from an external command?" might give some ideas.

Thanks for the tip - yes my code does use external perl modules to
return values - different modules return different things and somehow
these are not in order when I try to collect them, the problem is this
does not happen is SUSE32 - is their an OS dependency
 
K

Klaus

Thanks for the tip - yes my code does use external perl modules to
return values

Please copy and paste a section from your perl program where you
actually call the external perl modules (if possible no more than 10
lines).
 
T

Tad McClellan

I am guessing that your function call has external commands (for
example system(), `...`, qx(), etc...).


It is bad netiquette to quote signatures.

Thanks for the tip - yes my code does use external perl modules to
return values


A "command" is not the same thing as a "module".

He did not ask if you use external modules, he asked if you
used external (command line) commands.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top