SVN: toys/rsget.pl/RSGet/Tools.pm
sparky
sparky at pld-linux.org
Fri Sep 11 18:52:24 CEST 2009
Author: sparky
Date: Fri Sep 11 18:52:24 2009
New Revision: 10564
Modified:
toys/rsget.pl/RSGet/Tools.pm
Log:
- dump_to_file() sometimes useful when debugging getters
Modified: toys/rsget.pl/RSGet/Tools.pm
==============================================================================
--- toys/rsget.pl/RSGet/Tools.pm (original)
+++ toys/rsget.pl/RSGet/Tools.pm Fri Sep 11 18:52:24 2009
@@ -7,7 +7,7 @@
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(s2string bignum de_ml hadd hprint p isotime require_prog
- randomize %getters %settings);
+ dump_to_file randomize %getters %settings);
@EXPORT_OK = qw();
our %settings;
@@ -93,5 +93,23 @@
return undef;
}
+sub dump_to_file
+{
+ my $data = shift;
+ my $ext = shift || "txt";
+ my $i = 0;
+ my $file;
+ do {
+ $i++;
+ $file = "dump.$i.$ext";
+ } while ( -e $file );
+
+ open my $f_out, '>', $file;
+ print $f_out $data;
+ close $f_out;
+
+ warn "data dumped to file: $file\n";
+}
+
1;
# vim:ts=4:sw=4
More information about the pld-cvs-commit
mailing list