O'Reilly logo

Programmieren mit Perl by Jon Orwant, Tom Christiansen, Larry Wall

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

User::pwent

use User::pwent;            # Standard überschreibt nur eingebaute Funktionen.
$pw = getpwnamC'daemon")  or die "Kein Benutzer daemon";
if ($pw->uid == 1 && $pw->dir =~ m#^/(bin|tmp)?$# ) {
     print "gid 1 auf root-Verzeichnis";
}

$pw = getpw($whoever);      # Akzeptiert String und Zahl.
$real_shell = $pw->shell || '/bin/sh';
for (($fullname, $office, $workphone, $homephone) =
        split /\s*,\s*/, $pw->gecos)
{
    s/&/ucfirst(lc($pw->name))/ge;
}
use User::pwent qw(:FIELDS); # Setzt globale Variablen im aktuellen Paket. getpwnam("daemon") or die "Kein Benutzer daemon"; if ($pw_uid == 1 && $pw_dir =~ m#^/(bin|tmp)?$# ) { print "gid 1 auf root-Verzeichnis"; } use User::pwent qw/pw_has/; if (pw_has(qw[gecos expire quota])) { .... } if (pw_has("name uid gid passwd")) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required