summaryrefslogtreecommitdiff
path: root/universal.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-07-12 22:53:48 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-07-12 23:12:05 -0700
commit2bde9ae6d41328ef8a0af7287fdbcbb982befeea (patch)
treee14ad85858a7140d178025e38e0580cd86e9de87 /universal.c
parentdb20b64061eaadedacbeffa6da95dab094e4cb40 (diff)
downloadperl-2bde9ae6d41328ef8a0af7287fdbcbb982befeea.tar.gz
[perl #113932] Make UNIVERSAL::can("STDOUT"...) work
For consistency with the way method lookup works, UNIVERSAL::can(...) should treat a bareword representing a filehandle as a lookup in the IO::File package (or whichever package implements that filehandle object).
Diffstat (limited to 'universal.c')
-rw-r--r--universal.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/universal.c b/universal.c
index 97231e2411..a57572bdfb 100644
--- a/universal.c
+++ b/universal.c
@@ -348,6 +348,7 @@ XS(XS_UNIVERSAL_can)
SV *sv;
SV *rv;
HV *pkg = NULL;
+ GV *iogv;
if (items != 2)
croak_xs_usage(cv, "object-ref, method");
@@ -373,6 +374,8 @@ XS(XS_UNIVERSAL_can)
}
else if (isGV_with_GP(sv) && GvIO(sv))
pkg = SvSTASH(GvIO(sv));
+ else if ((iogv = gv_fetchsv_nomg(sv, 0, SVt_PVIO)) && GvIO(iogv))
+ pkg = SvSTASH(GvIO(iogv));
else {
pkg = gv_stashsv(sv, 0);
if (!pkg)