case KEY_each: case KEY_eof: case KEY_exec:
case KEY_keys:
case KEY_lstat:
- case KEY_open: case KEY_pop:
+ case KEY_pop:
case KEY_push: case KEY_rand: case KEY_read:
case KEY_recv: case KEY_reset:
case KEY_select: case KEY_send:
I32 oa = opnum ? PL_opargs[opnum] >> OASHIFT : 0;
bool seen_question = 0;
const char *err = NULL;
+ const bool pushmark = PL_op->op_private & OPpCOREARGS_PUSHMARK;
/* Count how many args there are first, to get some idea how far to
extend the stack. */
/* We do this here, rather than with a separate pushmark op, as it has
to come in between two things this function does (stack reset and
arg pushing). This seems the easiest way to do it. */
- if (PL_op->op_private & OPpCOREARGS_PUSHMARK) {
+ if (pushmark) {
PUTBACK;
(void)Perl_pp_pushmark(aTHX);
}
);
oa >>= 4;
}
- for (;oa;(void)(numargs&&(++svp,--numargs))) {
+ for (; oa&&(numargs||!pushmark); (void)(numargs&&(++svp,--numargs))) {
whicharg++;
switch (oa & 7) {
case OA_SCALAR:
elsif ($p eq '@') {
# Do nothing, as we cannot test for too few or too many arguments.
}
- elsif ($p eq '$@') {
+ elsif ($p =~ '^[$*;]+@\z') {
$tests ++;
- eval " &CORE::$o() ";
+ $p =~ ';@';
+ my $minargs = $-[0];
+ eval " &CORE::$o((1)x($minargs-1)) ";
my $desc = quotemeta op_desc($o);
like $@, qr/^Not enough arguments for $desc at /,
"&$o with too few args";
lis [&mynot(0)], [!0], '¬ in list context';
test_proto 'oct', '666', 438;
+
+test_proto 'open';
+$tests += 5;
+$file = 'test.pl';
+ok &myopen('file'), '&open with 1 arg' or warn "1-arg open: $!";
+like <file>, qr|^#|, 'result of &open with 1 arg';
+close file;
+{
+ ok &myopen(my $fh, "test.pl"), 'two-arg &open';
+ ok $fh, '&open autovivifies';
+ like <$fh>, qr '^#', 'result of &open with 2 args';
+ last if is_miniperl;
+ $tests +=2;
+ ok &myopen(my $fh2, "<", \"sharummbles"), 'retval of 3-arg &open';
+ is <$fh2>, 'sharummbles', 'result of three-arg &open';
+}
+
test_proto 'opendir';
test_proto 'ord', chr(64), 64;