Curses-Devkit
view release on metacpan or search on metacpan
demos/async view on Meta::CPAN
# Do this forever.
for (;;)
{
# Activate the scrolling list.
my $itemPicked = $scroll->activate();
# Do we need to exit...
exit if ! defined $itemPicked;
# Get the password info.
my ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwnam ($listItems[$itemPicked]);
# Display it.
my $info = ["</B/5>Account Name<!B!5> $name",
"</B/5>UID <!B!5> $uid",
"</B/5>GID <!B!5> $gid",
"</B/5>Directory <!B!5> $dir",
"</B/5>Shell <!B!5> $shell"];
popupLabel ($info);
}
# Exit Cdk.
Cdk::end();
#
# This is the async function.
demos/pwdInfo view on Meta::CPAN
Cdk::init();
#
# This function loads up the passwd file and returns a reference to the
# data structure.
#
sub loadPasswd
{
my %passwd = ();
my @logins = ();
my ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell);
# Start reading through the passwd file.
while (($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwent)
{
# Store the information.
$passwd{$name} = "$uid$gid$comment$gcos$dir$shell";
push (@logins, $name);
}
return (\@logins, \%passwd);
}
# Load up the passwd file.
my ($logins, $passwdObject) = loadPasswd();
# Create a scrolling list of all the names.
demos/pwdInfo view on Meta::CPAN
if (!defined $selected)
{
Cdk::end();
exit 0;
}
# Get the name and display the info.
my $name = $logins->[$selected];
# Display the info.
my ($uid, $gid, $comment, $gcos, $dir, $shell) = split (//, $passwdObject->{$name});
my $info = ["Account Name : </R>$name",
"UID/GID : ($uid/$gid)",
"Comment : </R>$comment",
"GCOS Value : </R>$gcos",
"Home Directory : </R>$dir",
"Shell : </R>$shell"];
my $title = new Cdk::Label ('Message' => $info);
# Draw the label.
$title->draw ('Box' => "TRUE");
$title->wait();
( run in 1.311 second using v1.01-cache-2.11-cpan-5735350b133 )