summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-25 12:43:54 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-25 12:43:54 -0700
commitf6a1686942506c3f2a041ff124bdc34d22ed5f26 (patch)
tree6bf0544f289bd3fe06bce6f8eb4d5e76ff56617f /op.c
parente1a80902e5e9ce316c7cc56f6c15b52b0c0a9144 (diff)
downloadperl-f6a1686942506c3f2a041ff124bdc34d22ed5f26.tar.gz
&CORE::binmode()
This commit allows &CORE::binmode to be called through references and via ampersand syntax. Usually, an op that has optional arguments has the number of arguments indicated with flags on the op itself:
Diffstat (limited to 'op.c')
-rw-r--r--op.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/op.c b/op.c
index 606e086825..02811c622e 100644
--- a/op.c
+++ b/op.c
@@ -7685,7 +7685,16 @@ Perl_ck_fun(pTHX_ OP *o)
tokid = &kid->op_sibling;
kid = kid->op_sibling;
}
- if (kid && kid->op_type == OP_COREARGS) return o;
+ if (kid && kid->op_type == OP_COREARGS) {
+ bool optional = FALSE;
+ while (oa) {
+ numargs++;
+ if (oa & OA_OPTIONAL) optional = TRUE;
+ oa = oa >> 4;
+ }
+ if (optional) o->op_private |= numargs;
+ return o;
+ }
while (oa) {
if (oa & OA_OPTIONAL || (oa & 7) == OA_LIST) {