This commit allows &CORE::rand to be called through references and
via ampersand syntax. pp_rand is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell rand how many arguments it’s
actually getting. See commit
0163043a for details.
case KEY_keys:
case KEY_lstat:
case KEY_pop:
- case KEY_push: case KEY_rand: case KEY_read:
+ case KEY_push: case KEY_read:
case KEY_recv: case KEY_reset:
case KEY_select: case KEY_send:
case KEY_setpgrp: case KEY_shift: case KEY_sleep:
NV value;
if (MAXARG < 1)
value = 1.0;
+ else if (!TOPs) {
+ value = 1.0; (void)POPs;
+ }
else
value = POPn;
if (value == 0.0)
test_proto 'pipe';
test_proto 'quotemeta', '$', '\$';
+
+test_proto 'rand';
+$tests += 3;
+like &CORE::rand, qr/^0[.\d]*\z/, '&rand';
+unlike join(" ", &CORE::rand), qr/ /, '&rand in list context';
+&cmp_ok(&CORE::rand(78), qw '< 78', '&rand with 2 args');
+
test_proto 'readdir';
test_proto 'readline';