From: Robert 'phaylon' Sedlacek Date: Fri, 11 May 2012 21:43:32 +0000 (+0000) Subject: map users by name instead of id X-Git-Tag: v0.001_001~71 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=386a00c7bd80d98249571189f2017672c0b88554;p=scpubgit%2FSystem-Introspector.git map users by name instead of id --- diff --git a/lib/System/Introspector/Users.pm b/lib/System/Introspector/Users.pm index eeeb3a5..7db2e8a 100644 --- a/lib/System/Introspector/Users.pm +++ b/lib/System/Introspector/Users.pm @@ -28,7 +28,7 @@ sub gather { $data->{crontab} = transform_exceptions { $self->_gather_crontab($user); }; - $user{ $data->{uid} } = $data; + $user{ $data->{username} } = $data; } return { users => \%user }; }; diff --git a/t/users.t b/t/users.t index 2e9d653..707e9c6 100644 --- a/t/users.t +++ b/t/users.t @@ -6,7 +6,7 @@ use System::Introspector::Users; my $probe = System::Introspector::Users->new; my $data = $probe->gather; -ok((my $user = $data->{users}{ $> }), 'found own user'); +ok((my $user = $data->{users}{ +getlogin }), 'found own user'); ok(defined($user->{ $_ }), "$_ is defined") for qw( comment crontab gid groups home shell ssh uid username ); ok(not(exists $user->{crontab}{error}), 'no crontab error');