summaryrefslogtreecommitdiff
path: root/fml/lib/FML/User/Control.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2006-05-16 12:27:21 +0000
committerfukachan <fukachan>2006-05-16 12:27:21 +0000
commit6b77ccc4f7a45c690f3f864a939b633a9d02ab2f (patch)
treefd3cf003ae0c753dcbebf48c98bb311f410a4059 /fml/lib/FML/User/Control.pm
parentb90b3b91d15999f4fc9a3865219e56af0f8d4833 (diff)
downloadfml8-6b77ccc4f7a45c690f3f864a939b633a9d02ab2f.tar.gz
fml8-6b77ccc4f7a45c690f3f864a939b633a9d02ab2f.tar.bz2
fml8-6b77ccc4f7a45c690f3f864a939b633a9d02ab2f.zip
define get_user_total(), return the total number of addresses in list.
Diffstat (limited to 'fml/lib/FML/User/Control.pm')
-rw-r--r--fml/lib/FML/User/Control.pm38
1 files changed, 34 insertions, 4 deletions
diff --git a/fml/lib/FML/User/Control.pm b/fml/lib/FML/User/Control.pm
index 4f125e0c..1d769e2d 100644
--- a/fml/lib/FML/User/Control.pm
+++ b/fml/lib/FML/User/Control.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Control.pm,v 1.21 2006/02/18 08:36:49 fukachan Exp $
+# $FML: Control.pm,v 1.22 2006/03/05 08:08:37 fukachan Exp $
#
package FML::User::Control;
@@ -474,18 +474,18 @@ sub print_userlist
# Descriptions: return address list as ARRAY_REF.
-# Arguments: OBJ($self) OBJ($curproc) ARRAY_REF($list)
+# Arguments: OBJ($self) OBJ($curproc) ARRAY_REF($maps)
# Side Effects: none
# Return Value: ARRAY_REF
sub get_user_list
{
- my ($self, $curproc, $list) = @_;
+ my ($self, $curproc, $maps) = @_;
my $config = $curproc->config();
my $r = [];
$curproc->lock($lock_channel);
- for my $map (@$list) {
+ for my $map (@$maps) {
my $io = new IO::Adapter $map, $config;
my $key = '';
if (defined $io) {
@@ -503,6 +503,36 @@ sub get_user_list
}
+# Descriptions: return the total number of addresses in list.
+# Arguments: OBJ($self) OBJ($curproc) ARRAY_REF($maps)
+# Side Effects: none
+# Return Value: NUM
+sub get_user_total
+{
+ my ($self, $curproc, $maps) = @_;
+ my $config = $curproc->config();
+ my $total = 0;
+
+ $curproc->lock($lock_channel);
+
+ for my $map (@$maps) {
+ my $io = new IO::Adapter $map, $config;
+ my $key = '';
+ if (defined $io) {
+ $io->open();
+ while (defined($key = $io->get_next_key())) {
+ $total++;
+ }
+ $io->close();
+ }
+ }
+
+ $curproc->unlock($lock_channel);
+
+ return $total;
+}
+
+
=head1 CODING STYLE
See C<http://www.fml.org/software/FNF/> on fml coding style guide.