--- loncom/debugging_tools/dump_db.pl 2002/09/04 20:49:16 1.2 +++ loncom/debugging_tools/dump_db.pl 2003/09/04 14:32:46 1.3 @@ -4,7 +4,7 @@ # # dump_db.pl - dump a GDBM database to standard output, unescaping if asked to. # -# $Id: dump_db.pl,v 1.2 2002/09/04 20:49:16 matthew Exp $ +# $Id: dump_db.pl,v 1.3 2003/09/04 14:32:46 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -35,10 +35,10 @@ use GDBM_File; # # Options -my $unesc = 0; -my $help = 0; +my ($unesc,$help,$localize_times) = (0,0,0); GetOptions("unescape" => \$unesc, "u" => \$unesc, + "t" => \$localize_times, "help" => \$help); # @@ -52,7 +52,8 @@ database. Options: --help Display this help. --unescape Unescape the keys and values before printing them out. - --u Same as --unescape + -u Same as --unescape + -t Localize times when possible (human readable times) Examples: dump_db.pl mydata.db dump_db.pl mydata.db yourdata.db ourdata.db theirdata.db @@ -74,6 +75,11 @@ while (my $fname = shift) { $key = &unescape($key); $value = &unescape($value); } + if ($localize_times) { + if ($value =~ /^\s*([0-9]{10,10})\s*$/) { + $value = $value.' [ '.localtime($1).' ]'; + } + } print "$key = $value\n"; } untie %db;