++${"23::foo"};
ok UNIVERSAL::can("23", "can"), '"23" can can when the pack exists';
ok UNIVERSAL::can(23, "can"), '23 can can when the pack exists';
+sub IO::Handle::turn {}
+ok UNIVERSAL::can(*STDOUT, 'turn'), 'globs with IOs can';
+ok UNIVERSAL::can(\*STDOUT, 'turn'), 'globrefs with IOs can';
{
local $::TODO = '[perl #113932]';
- ok UNIVERSAL::can(*STDOUT, 'print'), 'globs with IOs can can';
- ok UNIVERSAL::can(\*STDOUT, 'print'), 'globrefs with IOs can can';
- sub IO::Handle::turn {}
# Should this pass? Or is the existing behaviour correct?
ok UNIVERSAL::can("STDOUT", 'turn'), 'IO barewords can';
}
SvGETMAGIC(sv);
- if (!SvOK(sv) || !(SvROK(sv) || SvNIOK(sv) || (SvPOK(sv) && SvCUR(sv))
- ))
+ /* Reject undef and empty string. Note that the string form takes
+ precedence here over the numeric form, as (!1)->foo treats the
+ invocant as the empty string, though it is a dualvar. */
+ if (!SvOK(sv) || (SvPOK(sv) && !SvCUR(sv)))
XSRETURN_UNDEF;
rv = &PL_sv_undef;
sv = MUTABLE_SV(SvRV(sv));
if (SvOBJECT(sv))
pkg = SvSTASH(sv);
+ else if (isGV_with_GP(sv) && GvIO(sv))
+ pkg = SvSTASH(GvIO(sv));
}
+ else if (isGV_with_GP(sv) && GvIO(sv))
+ pkg = SvSTASH(GvIO(sv));
else {
pkg = gv_stashsv(sv, 0);
if (!pkg)