From: Dave Mitchell Date: Sun, 28 Mar 2004 15:08:23 +0000 (+0000) Subject: make gv_fullname() etc include a literal '^' for *^FOO style names X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4ad16c232af72afff4d7d0d37f532c709df5d9f0;p=p5sagit%2Fp5-mst-13.2.git make gv_fullname() etc include a literal '^' for *^FOO style names p4raw-id: //depot/perl@22606 --- diff --git a/gv.c b/gv.c index 8a27065..b2ae13c 100644 --- 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 diff --git a/t/op/gv.t b/t/op/gv.t index 5b1237a..851f6b1 100755 --- a/t/op/gv.t +++ b/t/op/gv.t @@ -11,7 +11,7 @@ BEGIN { use warnings; -print "1..52\n"; +print "1..53\n"; # type coersion on assignment $foo = 'foo'; @@ -242,6 +242,9 @@ print $j[0] == 1 ? "ok 43\n" : "not ok 43\n"; print $x || "not ok 52\n"; } +# stringified typeglob should escape leading control char +print *^A eq "*main::^A" ? "ok 53\n" : "not ok 53\n"; + __END__ ok 44 ok 48