Changeset 16266
- Timestamp:
- 2008-07-02T08:51:56+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/util.pm
r15875 r16266 572 572 573 573 574 sub get_tmp_filename { 574 sub get_tmp_filename 575 { 576 my $file_ext = shift(@_) || undef; 577 578 my $opt_dot_file_ext = (defined $file_ext) ? ".$file_ext" : ""; 579 575 580 my $tmpdir = filename_cat($ENV{'GSDLHOME'}, "tmp"); 576 581 &mk_all_dir ($tmpdir) unless -e $tmpdir; … … 578 583 my $count = 1000; 579 584 my $rand = int(rand $count); 580 while (-e &filename_cat($tmpdir, "F$rand")) { 585 my $full_tmp_filename = &filename_cat($tmpdir, "F$rand$opt_dot_file_ext"); 586 587 while (-e $full_tmp_filename) { 581 588 $rand = int(rand $count); 589 $full_tmp_filename = &filename_cat($tmpdir, "F$rand$opt_dot_file_ext"); 582 590 $count++; 583 591 } 584 585 return filename_cat($tmpdir, "F$rand");592 593 return $full_tmp_filename; 586 594 } 587 595 … … 591 599 my (@filenames) = @_; 592 600 593 # Useful for debugging 594 # my ($cpackage,$cfilename,$cline,$csubr,$chas_args,$cwantarray) = caller(0); 601 # Useful for debugging 602 # -- might make sense to call caller(0) rather than (1)?? 603 # my ($cpackage,$cfilename,$cline,$csubr,$chas_args,$cwantarray) = caller(1); 595 604 # print STDERR "Calling method; $cfilename:$cline $cpackage->$csubr\n"; 596 605
Note:
See TracChangeset
for help on using the changeset viewer.