The prototype-generation code just needed a little tweaking
for this to work. It assumed that ‘;’ should not be emitted if
PL_opargs[opnum] & OA_DEFGV, which is not necessarily the case. It
only applies at the beginning of the prototype, hence the n check
(where n is the character position in the protoytpe). It also changed
the last $ to _ in the OA_DEFGV case, instead of the first. _ only
comes at the beginning of a prototype (at least for core functions;
ck_fun, incidentally, enforces this), but not necessarily at the end.
case KEY_lt : case KEY_ne : case KEY_or :
case KEY_system: case KEY_x : case KEY_xor :
return NULL;
- case KEY_mkdir:
- retsetpvs("_;$");
case KEY_keys: case KEY_values: case KEY_each:
retsetpvs("+");
case KEY_push: case KEY_unshift:
defgv = PL_opargs[i] & OA_DEFGV;
oa = PL_opargs[i] >> OASHIFT;
while (oa) {
- if (oa & OA_OPTIONAL && !seen_question && !defgv) {
+ if (oa & OA_OPTIONAL && !seen_question && (!defgv || n)) {
seen_question = 1;
str[n++] = ';';
}
str[n++] = ("?$@@%&*$")[oa & (OA_OPTIONAL - 1)];
oa = oa >> 4;
}
- if (defgv && str[n - 1] == '$')
- str[n - 1] = '_';
+ if (defgv && str[0] == '$')
+ str[0] = '_';
str[n++] = '\0';
sv_setpvn(sv, str, n - 1);
return sv;