X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUser.pm;h=4994c4e0b0e4c6fbabae178740f4eaf91143e7f5;hb=bd8b8aa6d37a7dde70d093c5552c29f519ac9613;hp=267c68ed9d3c6d86e70efb37761ac9f8de8d22cb;hpb=3b73a2dde8b378db6b56438699c5a1f233194dbf;p=spider.git diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 267c68ed..4994c4e0 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -20,7 +20,7 @@ use File::Copy; use Data::Structure::Util qw(unbless); use Time::HiRes qw(gettimeofday tv_interval); use IO::File; -use JSON; +use DXJSON; use strict; @@ -108,6 +108,7 @@ my $json; startt => '0,Start Time,cldatetime', connlist => '1,Connections,parraydifft', width => '0,Preferred Width', + rbnseeme => '0,RBN See Me', ); #no strict; @@ -135,7 +136,7 @@ sub init { my $mode = shift; - $json = JSON->new->canonical(1); + $json = DXJSON->new->canonical(1); my $fn = "users"; $filename = localdata("$fn.v3j"); unless (-e $filename || $mode == 2) { @@ -309,31 +310,13 @@ sub put # thaw the user sub decode { - my $s = shift; - my $ref; - eval { $ref = $json->decode($s) }; - if ($ref && !$@) { - return bless $ref, 'DXUser'; - } else { - LogDbg('DXUser', "DXUser::json_decode: on '$s' $@"); - } - return undef; + return $json->decode(shift, __PACKAGE__); } # freeze the user sub encode { - my $ref = shift; - unbless($ref); - my $s; - - eval {$s = $json->encode($ref) }; - if ($s && !$@) { - bless $ref, 'DXUser'; - return $s; - } else { - LogDbg('DXUser', "DXUser::json_encode $ref->{call}, $@"); - } + return $json->encode(shift); }