From 80836a6e6831e963c975485a02ff412288031439 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 7 May 2014 17:36:40 -0600 Subject: PATCH: [perl #121777] User-defined prop and packages The solution to this is to add the package name to the property name for run-time lookup. Thanks for Darin McBride for finding an inefficiency in an earlier version of this patch. --- regcomp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'regcomp.c') diff --git a/regcomp.c b/regcomp.c index 7f51feaad9..9ca959fd32 100644 --- a/regcomp.c +++ b/regcomp.c @@ -13619,6 +13619,19 @@ parseit: "Property '%"UTF8f"' is unknown", UTF8fARG(UTF, n, name)); } + + /* If the property name doesn't already have a package + * name, add the current one to it so that it can be + * referred to outside it. [perl #121777] */ + if (! instr(name, "::") && PL_curstash) { + char* full_name = Perl_form(aTHX_ + "%s::%s", + HvNAME(PL_curstash), + name); + n = strlen(full_name); + Safefree(name); + name = savepvn(full_name, n); + } Perl_sv_catpvf(aTHX_ listsv, "%cutf8::%"UTF8f"\n", (value == 'p' ? '+' : '!'), UTF8fARG(UTF, n, name)); -- cgit v1.2.1