summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index 1cea53fd10..fa36c500dc 100644
--- a/pp.c
+++ b/pp.c
@@ -3834,7 +3834,14 @@ PP(pp_pack)
case 'p':
while (len-- > 0) {
fromstr = NEXTFROM;
- aptr = SvPV_force(fromstr, na); /* XXX Error if TEMP? */
+ if (fromstr == &sv_undef)
+ aptr = NULL;
+ else {
+ if (SvREADONLY(fromstr) && curcop != &compiling) {
+ fromstr = sv_mortalcopy(fromstr);
+ }
+ aptr = SvPV_force(fromstr, na);
+ }
sv_catpvn(cat, (char*)&aptr, sizeof(char*));
}
break;