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
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to