projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Started on the dx cluster database stuff
[spider.git]
/
perl
/
DXUser.pm
diff --git
a/perl/DXUser.pm
b/perl/DXUser.pm
index 60abaeda3098f77598b67e2603f33790c3661c75..f5f7e0491f561351c0a146c5c98cdbcf3b1993b6 100644
(file)
--- a/
perl/DXUser.pm
+++ b/
perl/DXUser.pm
@@
-29,12
+29,24
@@
$filename = undef;
qra => 'Locator',
email => 'E-mail Address',
priv => 'Privilege Level',
qra => 'Locator',
email => 'E-mail Address',
priv => 'Privilege Level',
- sort => 'Type of User',
lastin => 'Last Time in',
passwd => 'Password',
lastin => 'Last Time in',
passwd => 'Password',
- addr => 'Full Address'
+ addr => 'Full Address',
+ 'sort' => 'Type of User', # A - ak1a, U - User, S - spider cluster, B - BBS
);
);
+sub AUTOLOAD
+{
+ my $self = shift;
+ my $name = $AUTOLOAD;
+
+ return if $name =~ /::DESTROY$/;
+ $name =~ s/.*:://o;
+
+ die "Non-existant field '$AUTOLOAD'" if !$valid{$name};
+ @_ ? $self->{$name} = shift : $self->{$name} ;
+}
+
#
# initialise the system
#
#
# initialise the system
#
@@
-42,8
+54,8
@@
sub init
{
my ($pkg, $fn) = @_;
{
my ($pkg, $fn) = @_;
- die "need a filename in User
\n
" if !$fn;
- $dbm = tie %u, MLDBM, $fn, O_CREAT|O_RDWR, 0666 or die "can't open user file: $fn ($!)
\n
";
+ die "need a filename in User" if !$fn;
+ $dbm = tie %u, MLDBM, $fn, O_CREAT|O_RDWR, 0666 or die "can't open user file: $fn ($!)";
$filename = $fn;
}
$filename = $fn;
}
@@
-78,7
+90,7
@@
sub new
sub get
{
sub get
{
- my
$call = shift
;
+ my
($pkg, $call) = @_
;
return $u{$call};
}
return $u{$call};
}
@@
-119,19
+131,19
@@
sub close
# return a list of valid elements
#
# return a list of valid elements
#
-sub
element
s
+sub
field
s
{
return keys(%valid);
}
#
{
return keys(%valid);
}
#
-# return a prompt
together with the existing value
+# return a prompt
for a field
#
#
-sub prompt
+sub
field_
prompt
{
my ($self, $ele) = @_;
{
my ($self, $ele) = @_;
- return
"$valid{$ele} [$self->{$ele}]"
;
+ return
$valid{$ele}
;
}
#
}
#
@@
-167,5
+179,12
@@
sub enter
}
return 0;
}
}
return 0;
}
+
+# some variable accessors
+sub sort
+{
+ my $self = shift;
+ @_ ? $self->{sort} = shift : $self->{sort} ;
+}
1;
__END__
1;
__END__