Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Building a log file

by Marshall (Canon)
on Jun 23, 2009 at 15:20 UTC ( [id://774058]=note: print w/replies, xml ) Need Help??


in reply to Re: Building a log file
in thread Building a log file

This is a good idea. Windows systems don't have tee, I hacked in this tee.pl awhile ago for my Windoze work. It is a simple program. The only tricky part is turning auto-flush on for write. Have fun to anybody who needs it.
#!/usr/bin/perl -w use strict; # tee program #### tee.pl ###### # quickie tool $| =1; #flushes I/O for each write. sub usage { print "TEE USAGE:\n tees stdout to a file and to stdout\n". " program | tee outfile\n"; } my $filename = shift @ARGV; usage unless $filename; open (OUTFILE, '>', "$filename") or (die "Can't open OUTFILE: $!"); while (<>) { print; print OUTFILE; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://774058]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2025-06-22 12:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.