| 1 |
Fix 'Unknown error' messages with attribute.pm. (Closes: #488088)
|
| 2 |
|
| 3 |
[perl #49472]
|
| 4 |
blead change 33265
|
| 5 |
|
| 6 |
From: Dave Mitchell <davem@fdisolutions.com>
|
| 7 |
Date: Sat, 9 Feb 2008 14:56:23 +0000
|
| 8 |
Subject: [PATCH] [perl #49472] Attributes + Unkown Error
|
| 9 |
An errored attribute sub still processes the attributes,
|
| 10 |
which require's attribute.pm, so make sure the error state is
|
| 11 |
passed to the new require
|
| 12 |
|
| 13 |
p4raw-id: //depot/perl@33265
|
| 14 |
---
|
| 15 |
t/comp/require.t | 16 +++++++++++++++-
|
| 16 |
toke.c | 1 +
|
| 17 |
2 files changed, 16 insertions(+), 1 deletions(-)
|
| 18 |
|
| 19 |
diff --git a/t/comp/require.t b/t/comp/require.t
|
| 20 |
index af5e4b2..0746b3b 100755
|
| 21 |
--- a/t/comp/require.t
|
| 22 |
+++ b/t/comp/require.t
|
| 23 |
@@ -15,7 +15,7 @@ krunch.pm krunch.pmc whap.pm whap.pmc);
|
| 24 |
|
| 25 |
my $Is_EBCDIC = (ord('A') == 193) ? 1 : 0;
|
| 26 |
my $Is_UTF8 = (${^OPEN} || "") =~ /:utf8/;
|
| 27 |
-my $total_tests = 49;
|
| 28 |
+my $total_tests = 50;
|
| 29 |
if ($Is_EBCDIC || $Is_UTF8) { $total_tests -= 3; }
|
| 30 |
print "1..$total_tests\n";
|
| 31 |
|
| 32 |
@@ -258,6 +258,20 @@ EOT
|
| 33 |
}
|
| 34 |
}
|
| 35 |
|
| 36 |
+# [perl #49472] Attributes + Unkown Error
|
| 37 |
+
|
| 38 |
+{
|
| 39 |
+ do_require
|
| 40 |
+ 'use strict;sub MODIFY_CODE_ATTRIBUTE{} sub f:Blah {$nosuchvar}';
|
| 41 |
+ my $err = $@;
|
| 42 |
+ $err .= "\n" unless $err =~ /\n$/;
|
| 43 |
+ unless ($err =~ /Global symbol "\$nosuchvar" requires /) {
|
| 44 |
+ $err =~ s/^/# /mg;
|
| 45 |
+ print "${err}not ";
|
| 46 |
+ }
|
| 47 |
+ print "ok ", ++$i, " [perl #49472]\n";
|
| 48 |
+}
|
| 49 |
+
|
| 50 |
##########################################
|
| 51 |
# What follows are UTF-8 specific tests. #
|
| 52 |
# Add generic tests before this point. #
|
| 53 |
diff --git a/toke.c b/toke.c
|
| 54 |
index 2ae8b75..ecee902 100644
|
| 55 |
--- a/toke.c
|
| 56 |
+++ b/toke.c
|
| 57 |
@@ -692,6 +692,7 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, bool new_filter)
|
| 58 |
#else
|
| 59 |
parser->nexttoke = 0;
|
| 60 |
#endif
|
| 61 |
+ parser->error_count = oparser ? oparser->error_count : 0;
|
| 62 |
parser->copline = NOLINE;
|
| 63 |
parser->lex_state = LEX_NORMAL;
|
| 64 |
parser->expect = XSTATE;
|
| 65 |
--
|
| 66 |
1.5.6.5
|
| 67 |
|