BEGIN { overload::constant integer => sub {}; undef *^H }
1
EXPECT
-Constant(undef) unknown at - line 3, at end of line
+Constant(1) unknown at - line 3, at end of line
Execution of - aborted due to compilation errors.
########
# NAME Float constant overloading returning undef
BEGIN { overload::constant float => sub {}; undef *^H }
1.1
EXPECT
-Constant(undef) unknown at - line 3, at end of line
+Constant(1.1) unknown at - line 3, at end of line
Execution of - aborted due to compilation errors.
########
# NAME Binary constant overloading returning undef
BEGIN { overload::constant binary => sub {}; undef *^H }
0x1
EXPECT
-Constant(undef) unknown at - line 3, at end of line
+Constant(0x1) unknown at - line 3, at end of line
Execution of - aborted due to compilation errors.
########
# NAME String constant overloading returning undef
BEGIN { overload::constant integer => sub {} }
1
EXPECT
-Constant(undef): Call to &{$^H{integer}} did not return a defined value at - line 3, at end of line
+Constant(1): Call to &{$^H{integer}} did not return a defined value at - line 3, at end of line
Execution of - aborted due to compilation errors.
########
# NAME Float constant overloading returning undef
BEGIN { overload::constant float => sub {} }
1.1
EXPECT
-Constant(undef): Call to &{$^H{float}} did not return a defined value at - line 3, at end of line
+Constant(1.1): Call to &{$^H{float}} did not return a defined value at - line 3, at end of line
Execution of - aborted due to compilation errors.
########
# NAME Binary constant overloading returning undef
BEGIN { overload::constant binary => sub {} }
0x1
EXPECT
-Constant(undef): Call to &{$^H{binary}} did not return a defined value at - line 3, at end of line
+Constant(0x1): Call to &{$^H{binary}} did not return a defined value at - line 3, at end of line
Execution of - aborted due to compilation errors.
########
# NAME String constant overloading returning undef
PERL_ARGS_ASSERT_NEW_CONSTANT;
/* We assume that this is true: */
if (*key == 'c') { assert (strEQ(key, "charnames")); }
+ assert(type || s);
/* charnames doesn't work well if there have been errors found */
if (PL_error_count > 0 && *key == 'c')
}
if (!table || !(PL_hints & HINT_LOCALIZE_HH)) {
msg = Perl_newSVpvf(aTHX_
- "Constant(%s) unknown", (type ? type: "undef"));
+ "Constant(%.*s) unknown",
+ (int)(type ? typelen : len),
+ (type ? type: s));
}
else {
why1 = "$^H{";
return sv;
}
else {
- msg = Perl_newSVpvf(aTHX_ "Constant(%s): %s%s%s",
- (type ? type: "undef"), why1, why2, why3);
+ msg = Perl_newSVpvf(aTHX_ "Constant(%.*s): %s%s%s",
+ (int)(type ? typelen : len),
+ (type ? type: s), why1, why2, why3);
}
}
yyerror(SvPVX_const(msg));