/ my $currversionfile = '/home/httpd/lonTabs/mimetex-version'; my $newversionfile = '../cgi/mimeTeX/VERSION'; my $fh; if (-e $newversionfile) { if (open($fh, "<$newversionfile")) { my $newversion = <$fh>; close($fh); chomp($newversion); if ($newversion=~ /^\d+\.\d+$/) { if (-e $currversionfile) { if (open($fh, "<$currversionfile")) { my $currversion = <$fh>; close($fh); chomp($version); if ($currversion=~ /^\d+\.\d+$/) { if ($currversion ne $newversion) { &clear_mimetex_cache(); if (open($fh, ">$currversionfile")) { print $fh "$newversion"; close($fh); print "mimetex-version file in /home/httpd/lonTabs set to version: $newversion.\n"; } } } } } else { &clear_mimetex_cache(); if (open($fh, ">$currversionfile")) { print $fh "$newversion"; close($fh); print "mimetex-version file in /home/httpd/lonTabs set to version: $newversion.\n"; } } } } } else { print "Couldn't find the mimetex version file: $newversionfile\n"; } sub clear_mimetex_cache { my $mimetexcache = '/home/httpd/cgi-bin/mimetexcache'; if (opendir(my $dir,$mimetexcache)) { my @gifs = grep(/^[^\/]+\.gif$/,readdir($dir)); if (@gifs > 0) { my $counter = 0; foreach my $gif (@gifs) { unlink("$mimetexcache/$gif"); $counter ++; } if ($counter) { print "$counter .gif file(s) cached by previous mimeTeX version have been removed from the mimetexcache directory\n"; } } closedir($dir); } else { print "An error occurred opening the directory: $mimetexcache\n"; } } 500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.