On Jan 16, 2004, at 5:02 PM, Larry Guest wrote:
Here's a bit of a wacky Idea - solve it by> I have a small script that does some admin work for me.
> What I need to do now is not only have is display information to STDERR
> and STDOUT but also write the same information I see when I run the
> command to a file.
> I have written it for others who are not very technical. I want them
> be able to see the script working and what it is doing. But I also
> a log file of the same information so I can have it mailed to me and
> keep a copy on the server.
a bit of indirection - namely write the
code so that it does what you want it to do
then nest it inside of a script like say
myPerlCode 2>&1 | tee /tmp/myOutput.$$
mail me -s "command run" < /tmp/myOutput.$$
/bin/rm -f /tmp/myOutput.$$
that way your perl code remains simple, but what you
hand out to the users to use is going to deal with
all of the STDOUT|STDERR as well a always sending
you the email...