X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUser.pm;h=419156d3ac6dc75ecf2b6b1491e9b1ae5d5f307c;hb=6be3e1147b774c96b9d35c4c835f913e9c5e0ffc;hp=0785d16b2c1b1a6c1945ef41cc67a074b0a5dbbb;hpb=0a26d8269de811ac52450fcb411ebac7cab1d382;p=spider.git diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 0785d16b..419156d3 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -16,6 +16,13 @@ use IO::File; use DXDebug; use strict; + +use vars qw($VERSION $BRANCH); +$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); +$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0; +$main::build += $VERSION; +$main::branch += $BRANCH; + use vars qw(%u $dbm $filename %valid $lastoperinterval $lasttime); %u = (); @@ -63,8 +70,9 @@ $lasttime = 0; pingint => '9,Node Ping interval', nopings => '9,Ping Obs Count', wantlogininfo => '9,Login info req,yesno', - wantgrid => '0,DX Grid Info,yesno', + wantgrid => '0,DX Grid Info,yesno', lastoper => '9,Last for/oper,cldatetime', + nothere => '0,Not Here Text', ); no strict; @@ -77,6 +85,9 @@ sub AUTOLOAD $name =~ s/.*:://o; confess "Non-existant field '$AUTOLOAD'" if !$valid{$name}; + # this clever line of code creates a subroutine which takes over from autoload + # from OO Perl - Conway + *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ; if (@_) { $self->{$name} = shift; } @@ -240,8 +251,8 @@ sub decode my $ref; eval '$ref = ' . $s; if ($@) { - dbg('err', $@) if $@; - Log('err', $@) if $@; + dbg($@); + Log('err', $@); $ref = undef; } return $ref; @@ -337,7 +348,7 @@ BEGIN { # try to detect a lockfile (this isn't atomic but # should do for now - $lockfn = "$root/perl/cluster.lock"; # lock file name + $lockfn = "$root/perl/cluster.lck"; # lock file name if (-e $lockfn) { open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!"; my $pid = ;