Digest::SHA1 and any dependant packages to run this release. HOWEVER tempted
you are, please don't set/newprotocol on any nodes. It won't work.
2. Make the cluster node registered on from startup (from Mark HB9DBM).
+3. Make the 'export_users' process *MUCH* more robust. It should now accept
+funny characters and not rely on an absolutely 'perfect' user file to work.
+Errors are displayed (and logged if done from the cluster) and then ignored.
+Invalid callsigns are removed.
09Jul02=======================================================================
1. make the is_qra more accurate (from Mark HB9DBM).
04Jul02=======================================================================
use Fcntl;
use IO::File;
use DXDebug;
+use DXUtil;
use strict;
rename "$fn", "$fn.o" if -e "$fn";
my $count = 0;
+ my $err = 0;
my $fh = new IO::File ">$fn" or return "cannot open $fn ($!)";
if ($fh) {
- my $ref = 0;
my $key = 0;
+ my $val = undef;
my $action;
my $t = scalar localtime;
print $fh q{#!/usr/bin/perl
DXUser->del_file($main::userfn);
DXUser->init($main::userfn, 1);
-
-%u = (
- };
-
- for ($action = R_FIRST; !$dbm->seq($key, $ref, $action); $action = R_NEXT) {
- print $fh "'$key' => q{$ref},\n";
- ++$count;
+%u = ();
+my $count = 0;
+my $err = 0;
+while (<DATA>) {
+ chomp;
+ my @f = split /\t/;
+ my $ref = decode($f[1]);
+ if ($ref) {
+ $ref->put();
+ $count++;
+ } else {
+ print "# Error: $f[0]\t$f[1]\n";
+ $err++
+ }
+}
+DXUser->sync; DXUser->finish;
+print "There are $count user records and $err errors\n";
+};
+ print $fh "__DATA__\n";
+
+ for ($action = R_FIRST; !$dbm->seq($key, $val, $action); $action = R_NEXT) {
+ if (!is_callsign($key) || $key =~ /^0/) {
+ Log('DXCommand', "Export Error: $key\t$val");
+ $dbm->del($key);
+ ++$err;
+ next;
+ }
+ my $ref = decode($val);
+ if ($ref) {
+ print $fh "$key\t" . $ref->encode . "\n";
+ ++$count;
+ } else {
+ Log('DXCommand', "Export Error: $key\t$val");
+ $dbm->del($key);
+ ++$err;
+ }
}
- print $fh ");\n#\nprint \"there were $count records\\n\";\n#\n";
- print $fh "DXUser->sync; DXUser->finish;\n#\n";
$fh->close;
}
- return $count;
+ return "$count Users $err Errors ('sh/log Export' for details)";
}
#