diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-11-05 17:22:01 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-11-05 17:22:01 +0000 |
commit | 41ab332feccc7634fd538d8b8d2d84e2f2935ca3 (patch) | |
tree | ec29231ae7d3d4254401582952087a2958bf98f5 | |
parent | 26d80d95d5f45fb7ee62878b8d2a2a9ff983270f (diff) | |
download | perl-41ab332feccc7634fd538d8b8d2d84e2f2935ca3.tar.gz |
A fix of sorts for 20000329.026, a better error message
for a missing "use charnames" when using the \N{...}.
p4raw-id: //depot/perl@7557
-rw-r--r-- | pod/perldiag.pod | 2 | ||||
-rw-r--r-- | toke.c | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 452938cb7c..20a4a76db3 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1086,7 +1086,7 @@ on I<Mastering Regular Expressions>.) to check the return value of your socket() call? See L<perlfunc/connect>. -=item constant(%s): %s +=item Constant(%s)%s: %s (F) The parser found inconsistencies either while attempting to define an overloaded constant, or when trying to find the character name @@ -5749,14 +5749,23 @@ S_new_constant(pTHX_ char *s, STRLEN len, const char *key, SV *sv, SV *pv, if (!table || !(PL_hints & HINT_LOCALIZE_HH)) { SV *msg; - why1 = "%^H is not consistent"; why2 = strEQ(key,"charnames") - ? " (missing \"use charnames ...\"?)" + ? "(possibly a missing \"use charnames ...\")" : ""; - why3 = ""; + msg = Perl_newSVpvf(aTHX_ "Constant(%s) unknown: %s", + (type ? type: "undef"), why2); + + /* This is convoluted and evil ("goto considered harmful") + * but I do not understand the intricacies of all the different + * failure modes of %^H in here. The goal here is to make + * the most probable error message user-friendly. --jhi */ + + goto msgdone; + report: - msg = Perl_newSVpvf(aTHX_ "constant(%s): %s%s%s", + msg = Perl_newSVpvf(aTHX_ "Constant(%s): %s%s%s", (type ? type: "undef"), why1, why2, why3); + msgdone: yyerror(SvPVX(msg)); SvREFCNT_dec(msg); return sv; |