Subject: | Bug in Cache::FileBackend 1.27 on Win32 |
Cache::FileBackend 1.27 does not pass a drive letter to File::Temp::tempfile(). This is not a problem on a Unix based system, but on a Win32 system causes Cache::FileCache to die:
"Error in tempfile() using \temp\FileCache\Default\9\2\4\XXXXXXXXXX: Parent directory (\temp\FileCache\Default\9\2\4\) is not a directory at C:/Perl/site/lib/Cache/FileBackend.pm line 563"
The attached patch corrects this behaviour, prepending the directory path with a drive letter if one is present or an empty string if not. I have verified this fix on Windows 2003 with ActivePerl 5.8.7 and Windows 2000 with ActivePerl 5.8.4.
--- FileBackend_orig.pm Wed Jul 13 14:53:41 2005
+++ FileBackend.pm Wed Jul 13 14:55:50 2005
@@ -559,7 +559,8 @@
my ( $volume, $directory, $filename ) = File::Spec->splitpath( $p_path );
- my ( $temp_fh, $temp_filename ) = tempfile( DIR => $directory );
+ $volume ||= '';
+ my ( $temp_fh, $temp_filename ) = tempfile( DIR => $volume . $directory );
binmode( $temp_fh );