if (IoDIRP(io))
Perl_ck_warner_d(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED),
- "Opening dirhandle %s also as a file",
- GvENAME(gv));
+ "Opening dirhandle %"SVf" also as a file",
+ SVfARG(sv_2mortal(newSVhek(GvENAME_HEK(gv)))));
mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar);
if (mg) {
cv = GvFORM(fgv);
if (!cv) {
- const char *name;
tmpsv = sv_newmortal();
gv_efullname4(tmpsv, fgv, NULL, FALSE);
- name = SvPV_nolen_const(tmpsv);
- if (name && *name)
- DIE(aTHX_ "Undefined format \"%s\" called", name);
+ if (SvPOK(tmpsv) && *SvPV_nolen_const(tmpsv))
+ DIE(aTHX_ "Undefined format \"%"SVf"\" called", SVfARG(tmpsv));
not_a_format_reference:
DIE(aTHX_ "Not a format reference");
SV *topname;
if (!IoFMT_NAME(io))
IoFMT_NAME(io) = savepv(GvNAME(gv));
- topname = sv_2mortal(Perl_newSVpvf(aTHX_ "%s_TOP", GvNAME(gv)));
+ topname = sv_2mortal(Perl_newSVpvf(aTHX_ "%"SVf"_TOP",
+ SVfARG(sv_2mortal(newSVhek(GvNAME_HEK(gv))))));
topgv = gv_fetchsv(topname, 0, SVt_PVFM);
if ((topgv && GvFORM(topgv)) ||
!gv_fetchpvs("top", GV_NOTQUAL, SVt_PVFM))
cv = GvFORM(fgv);
if (!cv) {
SV * const sv = sv_newmortal();
- const char *name;
gv_efullname4(sv, fgv, NULL, FALSE);
- name = SvPV_nolen_const(sv);
- if (name && *name)
- DIE(aTHX_ "Undefined top format \"%s\" called", name);
+ if (SvPOK(sv) && *SvPV_nolen_const(sv))
+ DIE(aTHX_ "Undefined top format \"%"SVf"\" called", SVfARG(sv));
else
DIE(aTHX_ "Undefined top format called");
}
if (gv != PL_defgv) {
do_fstat_warning_check:
Perl_ck_warner(aTHX_ packWARN(WARN_IO),
- "lstat() on filehandle %s", gv ? GvENAME(gv) : "");
+ "lstat() on filehandle %"SVf, SVfARG(gv
+ ? sv_2mortal(newSVhek(GvENAME_HEK(gv)))
+ : &PL_sv_no));
} else if (PL_laststype != OP_LSTAT)
/* diag_listed_as: The stat preceding %s wasn't an lstat */
Perl_croak(aTHX_ "The stat preceding lstat() wasn't an lstat");
if ((IoIFP(io) || IoOFP(io)))
Perl_ck_warner_d(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED),
- "Opening filehandle %s also as a directory",
- GvENAME(gv));
+ "Opening filehandle %"SVf" also as a directory",
+ SVfARG(sv_2mortal(newSVhek(GvENAME_HEK(gv)))) );
if (IoDIRP(io))
PerlDir_close(IoDIRP(io));
if (!(IoDIRP(io) = PerlDir_open(dirname)))
if (!io || !IoDIRP(io)) {
Perl_ck_warner(aTHX_ packWARN(WARN_IO),
- "readdir() attempted on invalid dirhandle %s", GvENAME(gv));
+ "readdir() attempted on invalid dirhandle %"SVf,
+ SVfARG(sv_2mortal(newSVhek(GvENAME_HEK(gv)))));
goto nope;
}
if (!io || !IoDIRP(io)) {
Perl_ck_warner(aTHX_ packWARN(WARN_IO),
- "telldir() attempted on invalid dirhandle %s", GvENAME(gv));
+ "telldir() attempted on invalid dirhandle %"SVf,
+ SVfARG(sv_2mortal(newSVhek(GvENAME_HEK(gv)))));
goto nope;
}
if (!io || !IoDIRP(io)) {
Perl_ck_warner(aTHX_ packWARN(WARN_IO),
- "seekdir() attempted on invalid dirhandle %s", GvENAME(gv));
+ "seekdir() attempted on invalid dirhandle %"SVf,
+ SVfARG(sv_2mortal(newSVhek(GvENAME_HEK(gv)))));
goto nope;
}
(void)PerlDir_seek(IoDIRP(io), along);
if (!io || !IoDIRP(io)) {
Perl_ck_warner(aTHX_ packWARN(WARN_IO),
- "rewinddir() attempted on invalid dirhandle %s", GvENAME(gv));
+ "rewinddir() attempted on invalid dirhandle %"SVf,
+ SVfARG(sv_2mortal(newSVhek(GvENAME_HEK(gv)))));
goto nope;
}
(void)PerlDir_rewind(IoDIRP(io));
if (!io || !IoDIRP(io)) {
Perl_ck_warner(aTHX_ packWARN(WARN_IO),
- "closedir() attempted on invalid dirhandle %s", GvENAME(gv));
+ "closedir() attempted on invalid dirhandle %"SVf,
+ SVfARG(sv_2mortal(newSVhek(GvENAME_HEK(gv)))));
goto nope;
}
#ifdef VOID_CLOSEDIR
lstat() on filehandle FH at - line 6.
lstat() on filehandle $fh at - line 8.
########
+# TODO ? 1 ? "Scalar filehandles not yet UTF-8 clean" : ''
+# pp_sys.c [pp_lstat]
+use warnings 'io';
+use utf8;
+use open qw( :utf8 :std );
+open ᶠḨ, "../harness" or die "# $!";
+lstat ᶠḨ;
+open my $fᚺ, $0 or die "# $!";
+lstat $fᚺ;
+no warnings 'io';
+lstat ᶠḨ;
+lstat $fᚺ;
+close ᶠḨ;
+close $fᚺ;
+EXPECT
+lstat() on filehandle ᶠḨ at - line 6.
+lstat() on filehandle $fᚺ at - line 8.
+########
# pp_sys.c [pp_getc]
use warnings qw(unopened closed) ;
getc FOO;
Opening dirhandle FOO also as a file at - line 5.
Opening dirhandle $foo also as a file at - line 6.
########
+# TODO ? 1 ? "Scalar filehandles not yet UTF-8 clean" : ''
+# pp_sys.c [pp_open]
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+opendir FOO, ".";
+opendir $foo, ".";
+open FOO, "../harness";
+open $foo, "../harness";
+no warnings qw(io deprecated);
+open FOO, "../harness";
+open $foo, "../harness";
+EXPECT
+Opening dirhandle FOO also as a file at - line 7.
+Opening dirhandle $foo also as a file at - line 8.
+########
# pp_sys.c [pp_open_dir]
use warnings;
open FOO, "../harness";
EXPECT
Opening filehandle FOO also as a directory at - line 5.
Opening filehandle $foo also as a directory at - line 6.
+########
+# TODO ? 1 ? "Scalar filehandles not yet UTF-8 clean" : ''
+# pp_sys.c [pp_open_dir]
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+use warnings;
+open FOO, "../harness";
+open $foo, "../harness";
+opendir FOO, ".";
+opendir $foo, ".";
+no warnings qw(io deprecated);
+opendir FOO, ".";
+opendir $foo, ".";
+EXPECT
+Opening filehandle FOO also as a directory at - line 7.
+Opening filehandle $foo also as a directory at - line 8.
+########
+# pp_sys.c [pp_*dir]
+use warnings 'io';
+opendir FOO, ".";
+opendir $foo, ".";
+closedir FOO;
+closedir $foo;
+
+readdir(FOO);
+telldir(FOO);
+seekdir(FOO, 0);
+rewinddir(FOO);
+closedir(FOO);
+
+readdir($foo);
+telldir($foo);
+seekdir($foo, 0);
+rewinddir($foo);
+closedir($foo);
+
+EXPECT
+readdir() attempted on invalid dirhandle FOO at - line 8.
+telldir() attempted on invalid dirhandle FOO at - line 9.
+seekdir() attempted on invalid dirhandle FOO at - line 10.
+rewinddir() attempted on invalid dirhandle FOO at - line 11.
+closedir() attempted on invalid dirhandle FOO at - line 12.
+readdir() attempted on invalid dirhandle $foo at - line 14.
+telldir() attempted on invalid dirhandle $foo at - line 15.
+seekdir() attempted on invalid dirhandle $foo at - line 16.
+rewinddir() attempted on invalid dirhandle $foo at - line 17.
+closedir() attempted on invalid dirhandle $foo at - line 18.
+########
+# TODO ? 1 ? "Scalar filehandles not yet UTF-8 clean" : ''
+# pp_sys.c [pp_*dir]
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'io';
+opendir FOO, ".";
+opendir $foo, ".";
+opendir FOO, ".";
+opendir $foo, ".";
+closedir FOO;
+closedir $foo;
+
+readdir(FOO);
+telldir(FOO);
+seekdir(FOO, 0);
+rewinddir(FOO);
+closedir(FOO);
+
+readdir($foo);
+telldir($foo);
+seekdir($foo, 0);
+rewinddir($foo);
+closedir($foo);
+
+EXPECT
+readdir() attempted on invalid dirhandle FOO at - line 12.
+telldir() attempted on invalid dirhandle FOO at - line 13.
+seekdir() attempted on invalid dirhandle FOO at - line 14.
+rewinddir() attempted on invalid dirhandle FOO at - line 15.
+closedir() attempted on invalid dirhandle FOO at - line 16.
+readdir() attempted on invalid dirhandle $foo at - line 18.
+telldir() attempted on invalid dirhandle $foo at - line 19.
+seekdir() attempted on invalid dirhandle $foo at - line 20.
+rewinddir() attempted on invalid dirhandle $foo at - line 21.
+closedir() attempted on invalid dirhandle $foo at - line 22.