please help me solve another prob i am facing. i have 2 scripts --> a.pl and b.pl both scripts have a paramter called -logfile. if this is specified, the STDOUT and STDERR are redirected to this.
now, I call b.pl from within a.pl using system(). the documentation for system() says that the STDOUT, STDERR of the new process are inherited from the parent process. so, I expect that if I do not specify -logfile for b.pl but specify -logfile for a.pl, then the output for b.pl should also go to the logfile for a.pl but the output of b.pl is lost. if I do not specify the logfile for either script, then everything comes out fine on STDOUT. I am pasting the progs below : Thanks, Ashish #======================= # a.pl #======================= use Getopt::Long ; @cl = @ARGV ; # preserve for printing GetOptions ( "logfile=s" => \$logfile ); # if logfile defined, set it up. if (defined ($logfile)) { open (LOGFILE, ">>$logfile") or ERR_HANDLER ("main:LogFile:Cannot_Open") ; open (STDOUT , ">&LOGFILE"); # redefine STDOUT and STDERR to point to LOGFILE open (STDERR , ">&LOGFILE"); $| = 1 ; # better if logs are updated instantly } print ("$0 :: Starting ...\n") ; print ("CommandLine : @cl\n") ; print ("calling b.pl ...\n\n"); system ("b.pl") ; print ("$0 :: Finished ...\n") ; #==================== # b.pl #==================== use Getopt::Long ; @cl = @ARGV ; # preserve for printing GetOptions ( "logfile=s" => \$logfile ); # if logfile defined, set it up. if (defined ($logfile)) { open (LOGFILE, ">>$logfile") or ERR_HANDLER ("main:LogFile:Cannot_Open") ; open (STDOUT , ">&LOGFILE"); # redefine STDOUT and STDERR to point to LOGFILE open (STDERR , ">&LOGFILE"); $| = 1 ; # better if logs are updated instantly } print ("$0 :: Starting ...\n") ; print ("CommandLine : @cl\n") ; print ("$0 :: Finished ...\n") ; *********************************************************************** This communication is confidential and is intended only for the person to whom it is addressed. If you are not that person, you are not permitted to make use of the information and you are requested to notify administrator [EMAIL PROTECTED] immediately that you have received it and then destroy/erase the copy/e-mail in your possession. *********************************************************************** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]