Maybe...if( ( $statusLoadmsg = &FileExists( $logFile ) ) == $FALSE ) { &ResCode("WARNING"); &BrowseCode("File \"$logFile\" not found"); 
 &SummaryCode("WARNING"); return $WARNING; }
would do?do {warn "$logfile not found"; return $warning} unless -e $logfile;
...Hmm, is "readFileContents" any different than $contents = <$logfile>;(with $/=undef)? Then of course we have to ask why bother with the exsistance check in the first place. Oh, and what's up with all the $TRUE and $FALSE. Looks ugly and error prone to me. And by the description in the update, I'd guess you should be able to do what you want in less than 10 lines of code.# # read whole log file # if( &readFileContents( $logFile, $ContentsLoadMsg ) == $FALSE ) { &ResCode("E_LOADMSG_ERROR"); : &BrowseCode("Could not open \"$logFile\""); 
 &SummaryCode("E_MISLOAD_ERROR"); return $FALSE; }
In reply to Re: Code refactoring challenge
by Anonymous Monk
in thread Code refactoring challenge
by castaway
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |