require Exporter;
@ISA = qw(Exporter);
+use DXLog;
use DB_File;
+use Data::Dumper;
use Fcntl;
use Carp;
wanttalk => '0,Rec Talk,yesno',
wantwx => '0,Rec WX,yesno',
wantdx => '0,Rec DX Spots,yesno',
+ pingint => '9,Node Ping interval',
);
no strict;
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;
$self->{dxok} = 1;
$self->{annok} = 1;
$self->{lang} = $main::lang;
- $u{call} = $self->encode();
+ $self->put;
return $self;
}
sub put
{
my $self = shift;
+ confess "Trying to put nothing!" unless $self && ref $self;
my $call = $self->{call};
$u{$call} = $self->encode();
}
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;
}
#
my $s = shift;
my $ref;
$s = '$ref = ' . $s;
- eval { $s; };
+ eval $s;
Log('DXUser', $@) if $@;
$ref = undef if $@;
return $ref;
return _want('dx', @_);
}
+sub wanttalk
+{
+ return _want('talk', @_);
+}
+
1;
__END__