comparison MPIWGStor.pm @ 10:4417be0e2f07

adapted to dsmc's problem with mount points saves index.meta from overwriting by archived version
author casties
date Fri, 21 Jan 2005 15:33:26 +0100
parents 30497c6a3eca
children 620aad237f57
comparison
equal deleted inserted replaced
9:9c61f624d802 10:4417be0e2f07
11 use vars qw(@ISA @EXPORT $VERSION 11 use vars qw(@ISA @EXPORT $VERSION
12 $debug %junk_files %index_files $index_file_perm $archived_index_file_perm 12 $debug %junk_files %index_files $index_file_perm $archived_index_file_perm
13 $file_perm); 13 $file_perm);
14 use Exporter; 14 use Exporter;
15 15
16 $VERSION = 0.3; # ROC 24.9.2003 16 $VERSION = 0.4; # ROC 20.1.2005
17 17
18 @ISA = qw(Exporter); 18 @ISA = qw(Exporter);
19 19
20 @EXPORT = qw($debug %junk_files %index_files $index_file_perm $archived_index_file_perm 20 @EXPORT = qw($debug %junk_files %index_files $index_file_perm $archived_index_file_perm
21 $file_perm 21 $file_perm
22 &parseargs &logger &stime &s2stime &ymd_date &split_file_path &sstrip 22 &parseargs &logger &stime &s2stime &ymd_date &split_file_path &sstrip
23 &valid_file_name &valid_dir_name &read_xml &write_xml); 23 &valid_file_name &valid_dir_name &park_file &unpark_file &read_xml &write_xml);
24 24
25 # debug level 25 # debug level
26 $debug = 0; 26 $debug = 0;
27 27
28 # junk files 28 # junk files
209 return 1; 209 return 1;
210 } 210 }
211 211
212 212
213 # 213 #
214 # $newfilename = park_file($filename)
215 #
216 # parks a file under a new name (*.bak)
217 #
218 sub park_file {
219 my ($filename) = @_;
220 my $newfn = "";
221 if (-f $filename) {
222 $newfn = "$filename.bak";
223 if (! rename $filename, $newfn) {
224 logger("ABORT", "unable to rename file $filename!");
225 exit 1;
226 }
227 }
228 return $newfn;
229 }
230
231 #
232 # $filename = unpark_file($filename)
233 #
234 # unparks a file
235 #
236 sub unpark_file {
237 my ($filename) = @_;
238 my $newfn = "$filename.bak";
239 if (-f $newfn) {
240 if (! rename $newfn, $filename) {
241 logger("ABORT", "unable to rename file $newfn!");
242 exit 1;
243 }
244 return $filename;
245 }
246 return "";
247 }
248
249
250
251 #
214 # ($document, $rootnode) = read_xml($file) 252 # ($document, $rootnode) = read_xml($file)
215 # 253 #
216 # reads xml meta file $file 254 # reads xml meta file $file
217 # returns root node element 255 # returns root node element
218 # 256 #