On Thu, Jun 28, 2001 at 01:41:00PM -0500, Craig A. Berry wrote:
> Yes, I'd say that assigning to $? in an END block as documented in 
> perlvar.pod is apparently broken on VMS:

Welp, here's a core test.  Have fun fixing.

--- /dev/null   Sat Apr 14 22:09:58 2001
+++ t/run/exit.t        Thu Jun 28 15:47:48 2001
@@ -0,0 +1,28 @@
+#!./perl
+#
+# Tests for perl exit codes, playing with $?, etc...
+
+
+BEGIN {
+    chdir 't' if -d 't';
+#    @INC = '../lib';
+    require Config; import Config;
+    unless ($Config{'d_fork'}) {
+        print "1..0 # Skip: no fork\n";
+           exit 0;
+    }
+}
+
+use Test::More tests => 3;
+
+my $PERL = 'perl';
+my $exit;
+
+$exit = system($PERL.q{ -e 'exit'});
+is( $exit >> 8, 0,              'Normal exit' );
+
+$exit = system($PERL.q{ -e 'exit 42'});
+is( $exit >> 8, 42,             'Non-zero exit' );
+
+$exit = system($PERL.q{ -e 'END { $? = 42 }'});
+is( $exit >> 8, 42,             'Changing $? in END block' );




-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
That which stirs me, stirs everything.
        -- Squonk Opera, "Spoon"

Reply via email to