In the error message, we shouldn’t omit a handle whose name begins
with "\0", but, rather, a handle whose name has no length to it.
print() on unopened filehandle abc at - line 4.
########
# pp_hot.c [pp_print]
+use warnings 'unopened' ;
+$SIG{__WARN__} = sub { warn $_[0] =~ s/\0/\\0/rug; };
+print {"a\0b"} "anc";
+print {"\0b"} "anc";
+EXPECT
+print() on unopened filehandle a\0b at - line 4.
+print() on unopened filehandle \0b at - line 5.
+########
+# pp_hot.c [pp_print]
use warnings 'io' ;
# There is no guarantee that STDOUT is output only, or STDIN input only.
# Certainly on some BSDs (at least FreeBSD, Darwin, BSDi) file descriptors
(const char *)
(OP_IS_SOCKET(op) || (io && IoTYPE(io) == IoTYPE_SOCKET)
? "socket" : "filehandle");
- const bool have_name = name && *SvPV_nolen(name);
+ const bool have_name = name && SvCUR(name);
Perl_warner(aTHX_ packWARN(warn_type),
"%s%s on %s %s%s%"SVf, func, pars, vile, type,
have_name ? " " : "",