> -----Original Message-----
> From: Tony Esposito [mailto:tony1234567...@yahoo.co.uk] 
> Sent: Tuesday, July 21, 2009 08:08
> To: beginners@perl.org
> Subject: Fw: Having problems getting data back to STDOUT once 
> I assign it to a file
> 
> Back to the question at hand - have you tried using 'tee'
> 
        No. I just wanted to place back on the screen what the final processing 
would tell me(success or failure). At the beginning, I was creating an 
audittrail for the processing via the following:

if ( $GlblInfo{audit} ) {
    printf "All STDOUT/STDERR will be assigned to this scripts audittrail 
log!!\n";
    printf "All STDOUT/STDERR will be assigned to this scripts audittrail 
log!!\n";
    printf "All STDOUT/STDERR will be assigned to this scripts audittrail 
log!!\n";
    open(STDOUT, q[>>] . $GlblInfo{audittrail}) || dies(0, 
$GlblInfo{audittrail}, $!);
    select(STDOUT);
    $| = 1;
    open(STDERR, q[>>] . $GlblInfo{audittrail}) || dies(1, 
$GlblInfo{audittrail}, $!);
    select(STDERR);
    $| = 1;
 }
        The sub dies is my own little setup.

        It does take all the output destined for STDOUT and STDERR and places 
into a file. I have reviewed the output in the file and it is what I expect.

        I am running under Xp SP2 using AS 5.8.9 Build 825 ( Dec 2008 ). 
Running under a Korn shell, but have tried with the std command shell with all 
the same results.

        I do not go into a loop, but I would never have thought I would spend 
so much time for something so minor. At this point, I have tried everything but 
the tee (tee is not accomplishing what I wanted: off the screen and into a 
file) and always with the same results: no more output to STDOUT or STDERR. 
Everything that I read using perldoc and perliotut says to do this and this and 
you will have STDIN or STDOUT. Use '-' for STDIN and '>-' for STDOUT, but for 
whatever reason or the way I am doing it, I never see anything printed out..

        At this point, I will leave it alone for a while and see if anything 
else floats to the top.

        I appreciate all the responses, but never thought it would be this 
complicated to just get back to a STDOUT or STDERR.  It is Perl..
        
        Thanks.
 
Wags ;)
David R. Wagner
Senior Programmer Analyst
FedEx Freight Systems
1.719.484.2097 Tel
1.719.484.2419 Fax
1.408.623.5963 Cell
http://fedex.com/us 

> 
> use File::Tee qw(tee);
> 
> # simple usage:
> tee(STDOUT, '>', 'stdout.txt');
> 
> Tony
> 
> 
> 
> ________________________________
> From: John W. Krahn <jwkr...@shaw.ca>
> To: 
> Sent: Tuesday, 21 July, 2009 8:41:25
> Subject: Re: Having problems getting data back to STDOUT once 
> I assign it to a file
> 
> Shawn H. Corey wrote:
> > John W. Krahn wrote:
> >> Shawn H. Corey wrote:
> >>> Wagner, David --- Senior Programmer Analyst --- CFS wrote:
> >>>>    I am done processing and I want to place the final 
> output line also on the screen. Here is what I have:
> >>>> 
> >>>>    if ( $GlblInfo{audit} ) {
> >>>>        printf "\n\n*****Should be last line in the 
> audittrail file...*****\n\n";
> >>>>        close(STDOUT);
> >>>>        close(STDERR);
> >>>>        open(STDOUT , '>') || die "Unable to open STDOUT: $!";
> >>> 
> >>> You're not opening STDOUT to anything.  And you closed 
> STDERR so the die message can't go anywhere.  In fact, it 
> goes into an infinite loop.
> >> 
> >> No it doesn't, there is no loop there.
> > 
> > It goes into an infinite loop on my machine.  I suggest you 
> try it before you make such blanket statements.
> 
> I did and it doesn't on my machine.  Perhaps your OS or C 
> library is doing something stupid?  It makes no sense for IO 
> on an unopened filehandle to loop.
> 
> 
> 
> John
> -- Those people who think they know everything are a great
> annoyance to those of us who do.        -- Isaac Asimov
> 
> -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
> 
> 
>       
> 

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to