open(IMP, $fn) or return (1, "Cannot open $fn $!");
while (<IMP>) {
- chomp;
- s/\r//g;
+ s/[\r\n]+$//g;
if ($state == 0) {
if (/^\&\&/) {
$state = 0;
}
$key = uc $_;
$value = undef;
- ++$state;
+ ++$state if $key;
} elsif ($state == 1) {
if (/^\&\&/) {
if ($key =~ /^#/) {
+ } elsif ($key && $value) {
+ $db->putkey($key, $value);
+ $count++;
}
- $db->putkey($key, $value);
$state = 0;
- $count++;
+ next;
+ } elsif (/^\%\%/) {
+ $state = 0;
next;
}
$value .= $_ . "\n";
}
close (IMP);
-push @out, $self->msg('db10', $count, $db->name);
+push @out, $self->msg('db10', $count, $fn, $db->name);
return (1, @out);