#define vivify_defelem Perl_vivify_defelem
#define vivify_ref Perl_vivify_ref
#define wait4pid Perl_wait4pid
-#define report_closed_fh Perl_report_closed_fh
+#define report_evil_fh Perl_report_evil_fh
#define report_uninit Perl_report_uninit
#define warn Perl_warn
#define vwarn Perl_vwarn
#define vivify_defelem(a) Perl_vivify_defelem(aTHX_ a)
#define vivify_ref(a,b) Perl_vivify_ref(aTHX_ a,b)
#define wait4pid(a,b,c) Perl_wait4pid(aTHX_ a,b,c)
-#define report_closed_fh(a,b,c,d) Perl_report_closed_fh(aTHX_ a,b,c,d)
+#define report_evil_fh(a,b,c) Perl_report_evil_fh(aTHX_ a,b,c)
#define report_uninit() Perl_report_uninit(aTHX)
#define vwarn(a,b) Perl_vwarn(aTHX_ a,b)
#define vwarner(a,b,c) Perl_vwarner(aTHX_ a,b,c)
#define vivify_ref Perl_vivify_ref
#define Perl_wait4pid CPerlObj::Perl_wait4pid
#define wait4pid Perl_wait4pid
-#define Perl_report_closed_fh CPerlObj::Perl_report_closed_fh
-#define report_closed_fh Perl_report_closed_fh
+#define Perl_report_evil_fh CPerlObj::Perl_report_evil_fh
+#define report_evil_fh Perl_report_evil_fh
#define Perl_report_uninit CPerlObj::Perl_report_uninit
#define report_uninit Perl_report_uninit
#define Perl_warn CPerlObj::Perl_warn
void
Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32 op)
{
- bool closed = io && IoTYPE(io) == ' ';
- char *vile = closed ? "closed" : "unopened";
- I32 warn = closed ? WARN_CLOSED : WARN_UNOPENED;
+ char *vile;
+ I32 warn;
char *func =
op == OP_READLINE ? "readline" :
op == OP_LEAVEWRITE ? "write" :
PL_op_desc[op];
char *pars = OP_IS_FILETEST(op) ? "" : "()";
char *type = OP_IS_SOCKET(op) ? "socket" : "filehandle";
+ char *name = NULL;
if (isGV(gv)) {
SV *sv = sv_newmortal();
- char *name;
gv_efullname4(sv, gv, Nullch, FALSE);
name = SvPVX(sv);
+ }
- Perl_warner(aTHX_ warn, "%s%s on %s %s %s",
- func, pars, vile, type, name);
+ if (io && IoTYPE(io) == ' ') {
+ vile = "closed";
+ warn = WARN_CLOSED;
+ } else {
+ vile = "unopened";
+ warn = WARN_UNOPENED;
+ }
+ if (name) {
+ Perl_warner(aTHX_ warn,
+ "%s%s on %s %s %s", func, pars, vile, type, name);
if (io && IoDIRP(io))
Perl_warner(aTHX_ warn,
"\t(Are you trying to call %s%s on dirhandle %s?)\n",
func, pars, name);
} else {
- Perl_warner(aTHX_ warn, "%s%s on %s %s",
- func, pars, vile, type);
-
+ Perl_warner(aTHX_ warn,
+ "%s%s on %s %s", func, pars, vile, type);
if (io && IoDIRP(io))
Perl_warner(aTHX_ warn,
"\t(Are you trying to call %s%s on dirhandle?)\n",