This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make gv_fullname() etc include a literal '^' for *^FOO style names
[perl5.git] / gv.c
diff --git a/gv.c b/gv.c
index 8a27065..b2ae13c 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1096,7 +1096,13 @@ Perl_gv_fullname4(pTHX_ SV *sv, GV *gv, const char *prefix, bool keepmain)
        sv_catpv(sv,name);
        sv_catpvn(sv,"::", 2);
     }
-    sv_catpvn(sv,GvNAME(gv),GvNAMELEN(gv));
+    if (((unsigned int)*GvNAME(gv)) <= 26) { /* handle $^FOO */
+       Perl_sv_catpvf(aTHX_ sv,"^%c", *GvNAME(gv) + 'A' - 1);
+       sv_catpvn(sv,GvNAME(gv)+1,GvNAMELEN(gv)-1);
+    }
+    else
+       sv_catpvn(sv,GvNAME(gv),GvNAMELEN(gv));
+    
 }
 
 void