summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Sys/User.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2006-11-26 09:11:23 +0000
committerfukachan <fukachan>2006-11-26 09:11:23 +0000
commitf5729f9b3cbad866660dffcd48d9dcdad08bab56 (patch)
treefb1b4a807488025a57dfa58597db481173cee613 /fml/lib/FML/Sys/User.pm
parent44e29629c883d1c3be9467c0a589203c5cab7a41 (diff)
downloadfml8-f5729f9b3cbad866660dffcd48d9dcdad08bab56.tar.gz
fml8-f5729f9b3cbad866660dffcd48d9dcdad08bab56.tar.bz2
fml8-f5729f9b3cbad866660dffcd48d9dcdad08bab56.zip
fix comments.
add the label to a loop. define debug code by myself.
Diffstat (limited to 'fml/lib/FML/Sys/User.pm')
-rw-r--r--fml/lib/FML/Sys/User.pm30
1 files changed, 29 insertions, 1 deletions
diff --git a/fml/lib/FML/Sys/User.pm b/fml/lib/FML/Sys/User.pm
index 7fa7d0d0..389a3273 100644
--- a/fml/lib/FML/Sys/User.pm
+++ b/fml/lib/FML/Sys/User.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: User.pm,v 1.4 2004/07/23 13:16:44 fukachan Exp $
+# $FML: User.pm,v 1.5 2005/05/27 03:03:39 fukachan Exp $
#
package FML::Sys::User;
@@ -20,8 +20,14 @@ FML::Sys::User - get user information on this system.
=head1 SYNOPSIS
+use FML::Sys::User;
+my $sys = new FML::Sys::User $curproc;
+my $list = $sys->get_user_list();
+
=head1 DESCRIPTION
+This module provides methods to handle user information on this system.
+
=head1 METHODS
=head2 new()
@@ -44,6 +50,13 @@ sub new
}
+=head2 get_user_list()
+
+return user list as HASH_REF.
+
+=cut
+
+
# Descriptions: return user list as HASH_REF.
# Arguments: OBJ($self)
# Side Effects: none
@@ -72,6 +85,7 @@ sub _get_user_list_on_unix
my $fh = new FileHandle "/etc/passwd";
if (defined $fh) {
my ($user, $buf);
+ LINE:
while ($buf = <$fh>) {
($user) = split(/:/, $buf);
$users->{ $user } = $user;
@@ -85,6 +99,20 @@ sub _get_user_list_on_unix
}
+#
+# DEBUG
+#
+if ($0 eq __FILE__) {
+ my $sys = new FML::Sys::User;
+ my $list = $sys->get_user_list();
+
+ my ($k, $v);
+ for my $k (sort keys %$list) {
+ printf "%-20s => %s\n", $k, $list->{ $k };
+ }
+}
+
+
=head1 CODING STYLE
See C<http://www.fml.org/software/FNF/> on fml coding style guide.