The enclosed patch allows all 9 of the lib/User/pwent.t tests to pass on VMS (as opposed to the t/op/pwent.t tests that might better be addressed by a VMS specific test I have been working on but have not included here). Uid's on VMS are sufficiently from Unix that the test runs with the $< uid rather than 0 as on Unix and cygwin. Because of a struct passwd declaration in vms/vmsish.h we cannot (easily) build perl with i_pwd='define' (it is possible but not pretty - the vmsish passwd is much more unixy in its emulation). diff -ru perl_16267/lib/User/pwent.t perl/lib/User/pwent.t --- perl_16267/lib/User/pwent.t Thu Apr 25 12:56:11 2002 +++ perl/lib/User/pwent.t Wed May 1 10:06:22 2002 @@ -11,13 +11,18 @@ $haspw = 1 unless $@ && $@ =~ /unimplemented/; unless ($haspw) { print "1..0 # Skip: no getpwuid\n"; exit 0 } use Config; - $haspw = 0 unless $Config{'i_pwd'} eq 'define'; + # VMS's pwd.h struct passwd conflicts with the one in vmsish.h + $haspw = 0 unless ( $Config{'i_pwd'} eq 'define' || $^O eq 'VMS' ); unless ($haspw) { print "1..0 # Skip: no pwd.h\n"; exit 0 } } BEGIN { - our @pwent = getpwuid 0; # This is the function getpwuid. - unless (@pwent) { print "1..0 # Skip: no uid 0\n"; exit 0 } + our $uid = 0; + # On VMS getpwuid(0) may return [$gid,0] UIC info (which may not exist). + # It is better to use the $< uid for testing on VMS instead. + if ( $^O eq 'VMS' ) { $uid = $< ; } + our @pwent = getpwuid $uid; # This is the function getpwuid. + unless (@pwent) { print "1..0 # Skip: no uid $uid\n"; exit 0 } } print "1..9\n"; @@ -26,10 +31,12 @@ print "ok 1\n"; -my $pwent = getpwuid 0; # This is the OO getpwuid. +my $pwent = getpwuid $uid; # This is the OO getpwuid. -print "not " unless $pwent->uid == 0 || - ($^O eq 'cygwin' && $pwent->uid == 500); # go figure +my $uid_expect = $uid; +if ( $^O eq 'cygwin' ) { $uid_expect = 500; } # go figure + +print "not " unless $pwent->uid == $uid_expect ; print "ok 2\n"; print "not " unless $pwent->name eq $pwent[0]; End of Patch. Peter PrymmerThread Next