Jason Frisvold wrote: > Is there a way to redirect all the output (anything printed by the > program itself and any error output) back into the program so the > program can handle it? > > I'd like to be able to redirect it to itself so if there are any errors > or unexpected output during a cron job, it'll all get mailed to me... > > Make sense? >
yes, you can do something like: #!/usr/bin/perl -w use strict; set_it_up(); print "from set_it_up(), i got: ", scalar <STDIN>; close(STDOUT); sub set_it_up{ my $pid; return if $pid = open(STDOUT,"|-"); die("Unable to attache to STDOUT by fork: $!") unless(defined $pid); print "hello world\n"; } __END__ inside set_it_up() you are redirecting STDOUT back to your script. see if that's what you need. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]