ice_ice_ice has asked for the wisdom of the Perl Monks concerning the following question:
and this is subroutine which should change fileif ( time > $NEXT_TIME ) { print "Change file\n"; thread_log(); }
I know that this code can be written in better way so I'm open to any suggestions. Thanks in advance for any help ;)sub thread_log { #closing the handler to the current file if ( -e "log$FILE_NUMBER.log" ) { close($LOG_FILE); } $FILE_NUMBER += 1; open( $LOG_FILE, '>', "log$FILE_NUMBER.log" ) or die "Unable to open l +ogfile:$!\n"; $NEXT_TIME = $NEXT_TIME + 60; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with switching log files
by Sewi (Friar) on Dec 27, 2011 at 20:58 UTC | |
|
Re: Problem with switching log files
by RichardK (Parson) on Dec 27, 2011 at 19:18 UTC | |
by ice_ice_ice (Initiate) on Dec 27, 2011 at 19:20 UTC | |
by cavac (Prior) on Dec 27, 2011 at 20:07 UTC | |
by ice_ice_ice (Initiate) on Dec 27, 2011 at 19:36 UTC | |
by remiah (Hermit) on Dec 27, 2011 at 20:12 UTC | |
|
Re: Problem with switching log files
by TJPride (Pilgrim) on Dec 27, 2011 at 20:31 UTC | |
by ice_ice_ice (Initiate) on Dec 27, 2011 at 20:52 UTC |