X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUser.pm;h=9d534ae9d1835f6b2eaaeb4ab6b0fc33a2378260;hb=8ebfb28af6e8ec81acbd7de0f5e19fab4c32a8b6;hp=a6474abe51db668752c5832d7150dc97e6958cbc;hpb=81e9887d5b7cee45d2b810ab0f8f19d21f048eab;p=spider.git diff --git a/perl/DXUser.pm b/perl/DXUser.pm index a6474abe..9d534ae9 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -13,6 +13,7 @@ require Exporter; use DXLog; use DB_File; +use Data::Dumper; use Fcntl; use Carp; @@ -56,6 +57,7 @@ $filename = undef; wanttalk => '0,Rec Talk,yesno', wantwx => '0,Rec WX,yesno', wantdx => '0,Rec DX Spots,yesno', + pingint => '9,Node Ping interval', ); no strict; @@ -114,7 +116,7 @@ sub new my $call = uc shift; # $call =~ s/-\d+$//o; - confess "can't create existing call $call in User\n!" if $u{$call}; +# confess "can't create existing call $call in User\n!" if $u{$call}; my $self = bless {}, $pkg; $self->{call} = $call; @@ -122,7 +124,7 @@ sub new $self->{dxok} = 1; $self->{annok} = 1; $self->{lang} = $main::lang; - $u{call} = $self->encode(); + $self->put; return $self; } @@ -176,6 +178,7 @@ sub get_current sub put { my $self = shift; + confess "Trying to put nothing!" unless $self && ref $self; my $call = $self->{call}; $u{$call} = $self->encode(); } @@ -186,27 +189,11 @@ sub put sub encode { my $self = shift; - my $out; - my $f; - - $out = "bless( { "; - for $f (sort keys %$self) { - my $val = $$self{$f}; - if (ref $val) { # it's an array (we think) - $out .= "'$f'=>[ "; - foreach (@$val) { - my $s = $_; - $out .= "'$s',"; - } - $out .= " ],"; - } else { - $val =~ s/'/\\'/og; - $val =~ s/\@/\\@/og; - $out .= "'$f'=>q{$val},"; - } - } - $out .= " }, 'DXUser')"; - return $out; + my $dd = new Data::Dumper([$self]); + $dd->Indent(0); + $dd->Terse(1); + $dd->Quotekeys($] < 5.005 ? 1 : 0); + return $dd->Dumpxs; } # @@ -367,5 +354,10 @@ sub wantdx return _want('dx', @_); } +sub wanttalk +{ + return _want('talk', @_); +} + 1; __END__