CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Redirecting output to console AND(!!) file on Windows

 



Phil
Novice

Jul 7, 2008, 6:32 AM

Post #1 of 3 (1817 views)
Redirecting output to console AND(!!) file on Windows Can't Post

Hi all,

While the task described in the subjects seems to be quite simple I realized that it is VERY frustrating to achieve on Windows platforms. I've already mentioned some of the problems here: http://www.perlguru.com/gforum.cgi?post=31281

Of course I could call all external programs using backticks and then print the output on the screen and into the log file but this is not very satisfying because some programs take very long to execute (getting lots of files from source control) and I would like to see what happens in "real time".

How can this be achieved if piped open, 2>&1, "open(STDERR, ">&STDOUT");" and so on does not work?? I've also tried to use the IO::Tee module but this seems to have the same limitations.

Is there anyone out there that has somehow solved this problem? Can this be accomplished on that crappy cmd.exe? Any new ideas / help is appreciated.

Thanks!


KevinR
Veteran


Jul 7, 2008, 8:45 AM

Post #2 of 3 (1815 views)
Re: [Phil] Redirecting output to console AND(!!) file on Windows [In reply to] Can't Post

From the activeperl documentation:


Quote
STDIN and STDOUT, and Piping don't always work on NT/2000.

You may get unexpected results when you try to redirect the output of files that use Windows NT/2000's file association feature. You can use PerlApp or pl2bat to convert a Perl script to an executable or a batch file. This should solve any problems you may have with redirection.


I have never used PerlApp or pl2bat so can't help with how you use them. Look them up in the activeperl documentation (or google for them) if that is what you are using.
-------------------------------------------------


stamina_josh
New User

Jul 9, 2008, 4:08 AM

Post #3 of 3 (1760 views)
Re: [KevinR] Redirecting output to console AND(!!) file on Windows [In reply to] Can't Post

Hi, sorry if I am barking up the wrong tree or you have already tried this, but I generally do it and the prompt level via cygwin as follows:

perl somescript.pl | tee -a mylog.log

I imagine you have tried this and it is prob not quite what you are after but thought I would post just in case.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives