summaryrefslogtreecommitdiff
path: root/lib/User
diff options
context:
space:
mode:
authorPeter Prymmer <PPrymmer@factset.com>2002-05-01 06:12:53 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2002-05-01 13:16:12 +0000
commit8a1f71b21b0ce141933227d7faba7022f5ee8ce0 (patch)
treef6cd2daa2549b3a1ca0ad3d2e51ea38592cf7b73 /lib/User
parent6796b73ccdfc67a9ea46b55d3cfe324875c6f461 (diff)
downloadperl-8a1f71b21b0ce141933227d7faba7022f5ee8ce0.tar.gz
make lib/User/pwent.t run on VMS
Message-ID: <OFC387E5B4.FED37D7B-ON85256BAC.004DB0F0@55.25.11> p4raw-id: //depot/perl@16305
Diffstat (limited to 'lib/User')
-rw-r--r--lib/User/pwent.t19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/User/pwent.t b/lib/User/pwent.t
index 91a85ccbd2..853526c93b 100644
--- a/lib/User/pwent.t
+++ b/lib/User/pwent.t
@@ -11,13 +11,18 @@ BEGIN {
$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 @@ use User::pwent;
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];