version 1.5, 2005/03/18 21:36:49
|
version 1.7, 2006/08/08 18:20:50
|
Line 34 use Getopt::Long;
|
Line 34 use Getopt::Long;
|
use GDBM_File; |
use GDBM_File; |
use Data::Dumper; |
use Data::Dumper; |
use Storable qw(thaw); |
use Storable qw(thaw); |
|
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
use LONCAPA::Configuration; |
|
use Cwd; |
|
|
# |
# |
# Options |
# Options |
Line 64 END
|
Line 68 END
|
exit; |
exit; |
} |
} |
|
|
|
my %perlvar=%{&LONCAPA::Configuration::read_conf('loncapa.conf')}; |
|
|
# |
# |
# Loop through ARGV getting files. |
# Loop through ARGV getting files. |
while (my $fname = shift) { |
while (my $fname = shift) { |
my %db; |
$fname = &Cwd::abs_path($fname); |
if (! tie(%db,'GDBM_File',$fname,&GDBM_READER(),0640)) { |
my $dbref; |
|
if ($fname =~ m/^\Q$perlvar{'lonUsersDir'}\E/) { |
|
$dbref=&LONCAPA::locking_hash_tie($fname,&GDBM_READER()); |
|
} else { |
|
if (tie(my %db,'GDBM_File',$fname,&GDBM_READER(),0640)) { |
|
$dbref = \%db; |
|
} |
|
} |
|
|
|
if (!$dbref) { |
warn "Unable to tie to $fname"; |
warn "Unable to tie to $fname"; |
next; |
next; |
} |
} |
while (my ($key,$value) = each(%db)) { |
while (my ($key,$value) = each(%$dbref)) { |
if ($value =~ s/^__FROZEN__//) { |
if ($value =~ s/^__FROZEN__//) { |
$value = thaw(&unescape($value)); |
#$value = thaw(&unescape($value)); |
} |
} |
if ($unesc) { |
if ($unesc) { |
$key = &unescape($key); |
$key = &unescape($key); |
Line 85 while (my $fname = shift) {
|
Line 100 while (my $fname = shift) {
|
} |
} |
print "$key = ".(ref($value)?Dumper($value):$value)."\n"; |
print "$key = ".(ref($value)?Dumper($value):$value)."\n"; |
} |
} |
untie %db; |
&LONCAPA::locking_hash_untie($dbref); |
} |
} |
exit; |
exit; |
|
|
###################################### |
|
sub unescape { |
|
my $str=shift; |
|
$str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
|
return $str; |
|
} |
|