Use $^O, and change ungetc test under VMS to use normal file,
since stdin isn't always buffered. Change is specific to VMS,
in case Unix folks were trying to test whether it was possible
to ungetc one char onto a stream that hadn't been read.
chdir 't' if -d 't';
@INC = '../lib';
require Config; import Config;
- if ($Config{'extensions'} !~ /\bFileHandle\b/
- && $Config{'osname'} ne 'VMS') {
+ if ($Config{'extensions'} !~ /\bFileHandle\b/ && $^O ne 'VMS') {
print "1..0\n";
exit 0;
}
$buffer = <$fh>;
print $buffer eq "#!./perl\n" ? "ok 3\n" : "not ok 3\n";
-ungetc STDIN 65;
-CORE::read(STDIN, $buf,1);
+if ($^O eq 'VMS') {
+ ungetc $fh 65;
+ CORE::read($fh, $buf,1);
+}
+else {
+ ungetc STDIN 65;
+ CORE::read(STDIN, $buf,1);
+}
print $buf eq 'A' ? "ok 4\n" : "not ok 4\n";