From: Davide P.C. <dp...@un...> - 2005-09-10 01:03:18
|
>>>> (I'm not sure why it is necessary to make a local variable for >>>> LOG, but at least it works now.) >>> We want WW to be thread safe, so that when we port it to Apache 2 >>> (my next major project), people can run it under the threaded MPM. >> OK. I'll keep that in mind as I work on other parts. I guess >> that means most of the other file access code will have to be >> modified similarly. > Most of the file access code already uses lexical variables. A quick grep in webwork2/lib/WeBWorK turned up the following file references that don't seem to be localized: Utils.pm:606: if (open LOG, ">>", $logFile) { Utils.pm:623: if (open LOG, ">>", $logFile) { ContentGenerator/Grades.pm:98: } elsif ( open(FILE, "$filePath") ) { ContentGenerator/Grades.pm:141: open FILE, "$filePath" || return("Can't open $filePath"); ContentGenerator/Hardcopy.pm:495: open TEX, ">", $hardcopyFilePath or die "Failed to open $hardcopyFilePath: $! \n".CGI::br(); ContentGenerator/Hardcopy.pm:553: open TEX, ">", $texFile or die "Failed to open $texFile: $!\n".CGI::br(); ContentGenerator/Hardcopy.pm:636: open(LOGFILE,"<$filePath") or die "Can't read $filePath"; ContentGenerator/Hardcopy.pm:648: open (TEXFILE, "$texFilePath") DBv3/Utils.pm:70: sysopen LOCK, $lockfile, O_RDONLY|O_CREAT Utils/CourseManagement.pm:252: open(INSTRUCTOR,">> $courseDir/ instructor.txt") || warn "Can't create 'instructor.txt': $!"; Utils/CourseManagement.pm:256: open(TITLE,">> $courseDir/ coursetitle.txt") || warn "Can't create 'coursetitle.txt': $!"; ContentGenerator/Instructor/FileManager.pm:474: if (open (OUTFILE,">$file")) { ContentGenerator/Instructor/FileManager.pm:716: if (open(NEWFILE,">$file")) { ContentGenerator/Instructor/FileManager.pm:818: open(UPLOAD,"> $file") || $self->addbadmessage("Can't create file '$name'"); ContentGenerator/Instructor/PGProblemEditor.pm: 1024: open OUTPUTFILE, ">", $outputFilePath ContentGenerator/Instructor/ProblemSetEditor.pm:618: open (PROBLEM, ">$probFileName") || ContentGenerator/Instructor/ProblemSetList.pm:1477: if ( open (SETFILENAME, "$filePath") ) { ContentGenerator/Instructor/ProblemSetList.pm: 1673: open SETDEF, ">$filePath" or die "Failed to open $fileP ContentGenerator/Instructor/SendMail.pm:758: open (PROBLEM, "> $probFileName") || ContentGenerator/Instructor/SendMail.pm:775: open FILE, "$filePath" || do { $self->addbadmessage(CGI::p("Can't open $filePath")); return}; ContentGenerator/Instructor/SetMaker.pm:204: if ( open (SETFILENAME, "$filePath") ) { and in pg/lib, we have AnswerIO.pm:52: open(LOG, ">>$accessLog") or $error.= "Can't open course access log $accessLog"; WeBWorK/EquationCache.pm:93: sysopen(DB, $db, O_RDWR|O_CREAT) WeBWorK/PG/IO.pm:114: open(INPUT, "<$filePath") || die "$0: readWholeProblemFile subroutine: <BR>Can't read file $filePath"; WeBWorK/PG/IO.pm:173: open(TEMPCREATEFILE, ">$fileName") WeBWorK/PG/ImageGenerator.pm:75: open FILEH, "<$filename" or die "Unable to read $filename"; WeBWorK/PG/Translator.pm:508: if ( open(SOURCEFILE, "< $filePath") ) { So it looks like there are still a few out there to be taken care of. Davide |