develooper Front page | perl.perl5.changes | Postings from February 2008

Change 33265: [perl #49472] Attributes + Unkown Error

From:
Dave Mitchell
Date:
February 9, 2008 07:00
Subject:
Change 33265: [perl #49472] Attributes + Unkown Error
Message ID:
20080209150003.9C8A85008F@mx.activestate.com
Change 33265 by davem@davem-pigeon on 2008/02/09 14:56:23

	[perl #49472] Attributes + Unkown Error
	An errored attribute sub still processes the attributes,
	which require's attribute.pm, so make sure the error state is
	passed to the new require

Affected files ...

... //depot/perl/t/comp/require.t#43 edit
... //depot/perl/toke.c#816 edit

Differences ...

==== //depot/perl/t/comp/require.t#43 (xtext) ====
Index: perl/t/comp/require.t
--- perl/t/comp/require.t#42~32084~	2007-10-09 10:03:53.000000000 -0700
+++ perl/t/comp/require.t	2008-02-09 06:56:23.000000000 -0800
@@ -15,7 +15,7 @@
 
 my $Is_EBCDIC = (ord('A') == 193) ? 1 : 0;
 my $Is_UTF8   = (${^OPEN} || "") =~ /:utf8/;
-my $total_tests = 49;
+my $total_tests = 50;
 if ($Is_EBCDIC || $Is_UTF8) { $total_tests -= 3; }
 print "1..$total_tests\n";
 
@@ -258,6 +258,20 @@
     }
 }
 
+#  [perl #49472] Attributes + Unkown Error
+
+{
+    do_require
+	'use strict;sub MODIFY_CODE_ATTRIBUTE{} sub f:Blah {$nosuchvar}';
+    my $err = $@;
+    $err .= "\n" unless $err =~ /\n$/;
+    unless ($err =~ /Global symbol "\$nosuchvar" requires /) {
+	$err =~ s/^/# /mg;
+	print "${err}not ";
+    }
+    print "ok ", ++$i, " [perl #49472]\n";
+}
+
 ##########################################
 # What follows are UTF-8 specific tests. #
 # Add generic tests before this point.   #

==== //depot/perl/toke.c#816 (text) ====
Index: perl/toke.c
--- perl/toke.c#815~33103~	2008-01-29 02:53:24.000000000 -0800
+++ perl/toke.c	2008-02-09 06:56:23.000000000 -0800
@@ -692,6 +692,7 @@
 #else
     parser->nexttoke = 0;
 #endif
+    parser->error_count = oparser ? oparser->error_count : 0;
     parser->copline = NOLINE;
     parser->lex_state = LEX_NORMAL;
     parser->expect = XSTATE;
End of Patch.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About