This is how I got it to work. However any STDOUT completion messages will need 
to be done outside the brace.

}

local *STDOUT;

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 <[email protected]>
> 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: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>
>

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/



This message contains confidential information and is intended only for the 
individual named.  If you are not the named addressee you should not 
disseminate, distribute or copy this email.  Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system.  E-mail transmission cannot be guaranteed to be 
secure or error-free as information could be intercepted, corrupted, lost, 
destroyed, arrive late, or incomplete, or contain viruses.  The sender 
therefore does not accept liability for any errors or omissions in the contents 
of this message, which arise as a result of e-mail transmission.  If 
verification is required, please request a hard-copy version.

Tanager, INC
3140 West Ward Road
Suite 205
Dunkirk, MD 20754
www.tanagerinc.com

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to