[oak perl] perl can bite me

David Alban extasia at mindspring.com
Mon Nov 25 19:32:45 CST 2002


Belden,

At 2002/11/25/17:20 -0800 Belden Lyman <blyman at iii.com> wrote:
>      % perl
>      # perl in interactive mode
>      for my $login (qw(blyman root daemon nobody)) {
>        my $pwent = getpwnam( $login );
>        print $pwent ? "+ $login\n" : "- $login\n";
>      }
>      __END__
>      + blyman
>      - root      <-- huh?!
>      + daemon
>      + nobody
> 
> Coffee/beer/drink_of_your_choice is on me to the first
> person (except you, George [0] ) who can tell us why
> this isn't a bug in Perl.

Your doing the:

  $uid   = getpwnam($name);

invocation.  root's uid is zero, which is false.

You probably should test for defined() rather than truth.

Did I win? :-)

David
-- 
Live in a world of your own, but always welcome visitors.
                                 ***
Join us at sig-beer-west!  http://www.gerasimov.net/~alban/sig.beer.west.html
Unix sysadmin available:   http://www.gerasimov.net/~alban/jac/resume.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/oakland/attachments/20021125/5423ab3b/attachment.bin


More information about the Oakland mailing list