From: Michael G. Schwern Date: Mon, 12 Nov 2001 20:50:34 +0000 (-0500) Subject: Making vmsish.pm a no-op on non-VMS X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9f84c00564fd021b1da47513d58d337c301b73aa;p=p5sagit%2Fp5-mst-13.2.git Making vmsish.pm a no-op on non-VMS Message-ID: <20011112205034.H2888@blackrider> p4raw-id: //depot/perl@12971 --- diff --git a/MANIFEST b/MANIFEST index c0f2dd7..cf37116 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1633,6 +1633,8 @@ lib/utf8_heavy.pl Support routines for utf8 pragma lib/validate.pl Perl library supporting wholesale file mode validation lib/vars.pm Declare pseudo-imported global variables lib/vars.t See if "use vars" work +lib/vmsish.pm Control VMS-specific behavior of Perl core +lib/vmsish.t Tests for vmsish.pm lib/warnings.pm For "use warnings" lib/warnings.t See if warning controls work lib/warnings/register.pm For "use warnings::register" @@ -2317,8 +2319,6 @@ vms/ext/Stdio/Makefile.PL MakeMaker driver for VMS::Stdio vms/ext/Stdio/Stdio.pm VMS options to stdio routines vms/ext/Stdio/Stdio.xs VMS options to stdio routines vms/ext/Stdio/test.pl regression tests for VMS::Stdio -vms/ext/vmsish.pm Control VMS-specific behavior of Perl core -vms/ext/vmsish.t Tests for vmsish.pm vms/ext/XSSymSet.pm manage linker symbols when building extensions vms/genconfig.pl retcon config.sh from config.h vms/genopt.com hack to write options files in case of broken makes diff --git a/vms/ext/vmsish.pm b/lib/vmsish.pm similarity index 96% rename from vms/ext/vmsish.pm rename to lib/vmsish.pm index 89ec72c..bbaf4f7 100644 --- a/vms/ext/vmsish.pm +++ b/lib/vmsish.pm @@ -25,6 +25,8 @@ If no import list is supplied, all possible VMS-specific features are assumed. Currently, there are four VMS-specific features available: 'status' (a.k.a '$?'), 'exit', 'time' and 'hushed'. +If you're not running VMS, this module does nothing. + =over 6 =item C @@ -107,10 +109,7 @@ See L. =cut -if ($^O ne 'VMS') { - require Carp; - Carp::croak("This isn't VMS"); -} +my $IsVMS = $^O eq 'VMS'; sub bits { my $bits = 0; @@ -123,6 +122,8 @@ sub bits { } sub import { + return unless $IsVMS; + shift; $^H |= bits(@_ ? @_ : qw(status time)); my $sememe; @@ -134,6 +135,8 @@ sub import { } sub unimport { + return unless $IsVMS; + shift; $^H &= ~ bits(@_ ? @_ : qw(status time)); my $sememe; diff --git a/vms/ext/vmsish.t b/lib/vmsish.t similarity index 93% rename from vms/ext/vmsish.t rename to lib/vmsish.t index 0f3c0ec..2d83be6 100644 --- a/vms/ext/vmsish.t +++ b/lib/vmsish.t @@ -1,10 +1,26 @@ +#!./perl -BEGIN { unshift @INC, '[-.lib]'; } +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} my $Invoke_Perl = qq(MCR $^X "-I[-.lib]"); -require "test.pl"; -plan(tests => 24); +require "./test.pl"; +plan(tests => 25); + +SKIP: { + skip("tests for non-VMS only", 1) if $^O eq 'VMS'; + + BEGIN { $Orig_Bits = $^H } + + # make sure that all those 'use vmsish' calls didn't do anything. + is( $Orig_Bits, $^H, 'use vmsish a no-op' ); +} + +SKIP: { + skip("tests for VMS only", 24) unless $^O eq 'VMS'; #========== vmsish status ========== `$Invoke_Perl -e 1`; # Avoid system() from a pipe from harness. Mutter. @@ -128,6 +144,7 @@ is($?,0,"outer lex scope of vmsish [POSIX status]"); ok($vmsmtime - $utcmtime + $offset <= 10,"(stat) UTC: $utcmtime VMS: $vmsmtime"); } +} #====== need this to make sure error messages come out, even if # they were turned off in invoking procedure diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template index 9be280f..d303d2d 100644 --- a/vms/descrip_mms.template +++ b/vms/descrip_mms.template @@ -325,7 +325,7 @@ CRTLOPTS =,$(CRTL)/Options .endif # Modules which must be installed before we can build extensions -LIBPREREQ = $(ARCHDIR)Config.pm [.lib.VMS]Filespec.pm [.lib]DynaLoader.pm [.lib]XSLoader.pm [.lib]lib.pm [.lib]vmsish.pm [.lib.ExtUtils]XSSymSet.pm $(ARCHDIR)vmspipe.com [.lib]re.pm +LIBPREREQ = $(ARCHDIR)Config.pm [.lib.VMS]Filespec.pm [.lib]DynaLoader.pm [.lib]XSLoader.pm [.lib]lib.pm [.lib.ExtUtils]XSSymSet.pm $(ARCHDIR)vmspipe.com [.lib]re.pm utils1 = [.lib.pod]perldoc.com [.lib.ExtUtils]Miniperl.pm [.utils]c2ph.com [.utils]h2ph.com [.utils]h2xs.com [.lib]perlbug.com [.lib]perlcc.com [.utils]dprofpp.com utils2 = [.utils]perlivp.com [.lib]splain.com [.utils]pl2pm.com @@ -489,9 +489,6 @@ $(ARCHDIR)vmspipe.com : vmspipe.com dynext : $(LIBPREREQ) $(DBG)perlshr$(E) preplibrary @make_ext "$(MINIPERL_EXE)" "$(MMS)" -[.lib]vmsish.pm : [.vms.ext]vmsish.pm - Copy/Log/NoConfirm $(MMS$SOURCE) $(MMS$TARGET) - [.lib]lib.pm : [.lib]lib_pm.PL $(MINIPERL) $(MMS$SOURCE) @@ -908,9 +905,6 @@ perly$(O) : perly.c, perly.h, $(h) [.t.lib]vmsfspec.t : [.vms.ext]filespec.t Copy/Log/NoConfirm $(MMS$SOURCE) $(MMS$TARGET) -[.t.lib]vmsish.t : [.vms.ext]vmsish.t - Copy/Log/NoConfirm $(MMS$SOURCE) $(MMS$TARGET) - [.t.lib]vms_dclsym.t : [.vms.ext.DCLsym]test.pl Copy/Log/NoConfirm $(MMS$SOURCE) $(MMS$TARGET) @@ -920,7 +914,7 @@ perly$(O) : perly.c, perly.h, $(h) check : test @ Continue -test : all [.t.lib]vmsfspec.t [.t.lib]vmsish.t [.t.lib]vms_dclsym.t [.t.lib]vms_stdio.t +test : all [.t.lib]vmsfspec.t [.t.lib]vms_dclsym.t [.t.lib]vms_stdio.t - @[.VMS]Test.Com "$(E)" "$(__DEBUG__)" @ $(MINIPERL) -e "print ""Ran tests"";" > [.t]rantests.