SVN: toys/rsget.pl/RSGet/Get.pm

sparky sparky at pld-linux.org
Mon Jul 12 00:46:56 CEST 2010


Author: sparky
Date: Mon Jul 12 00:46:56 2010
New Revision: 11649

Modified:
   toys/rsget.pl/RSGet/Get.pm
Log:
- added tmpdir setting - directory where .cookie are stored


Modified: toys/rsget.pl/RSGet/Get.pm
==============================================================================
--- toys/rsget.pl/RSGet/Get.pm	(original)
+++ toys/rsget.pl/RSGet/Get.pm	Mon Jul 12 00:46:56 2010
@@ -21,6 +21,10 @@
 		allowed => qr/\d/,
 		type => "NUMBER",
 	},
+	tmpdir => {
+		desc => "Directory where temporary files (cookies and dumps) are stored.",
+		type => "PATH",
+	},
 );
 
 BEGIN {
@@ -41,6 +45,9 @@
 	my $n = $cookies{ $c }++;
 
 	local $_ = ".cookie.$c.$n.txt";
+	if ( my $dir = setting( "tmpdir" ) ) {
+		$_ = $dir . "/" . $_;
+	}
 	unlink $_ if -e $_;
 	return _cookie => $_;
 }
@@ -356,7 +363,10 @@
 		return;
 	}
 
-	my $file = sprintf "dump.$self->{_id}.%.4d.$ext",
+	my $dir = setting( "tmpdir" ) || "";
+	$dir .= "/" if $dir;
+
+	my $file = sprintf "${dir}dump.$self->{_id}.%.4d.$ext",
 		++$self->{_last_dump};
 
 	open my $f_out, '>', $file;


More information about the pld-cvs-commit mailing list