looks_like_bool(cLOGOPo->op_first)
&& looks_like_bool(cLOGOPo->op_first->op_sibling));
+ case OP_NULL:
+ return (
+ o->op_flags & OPf_KIDS
+ && looks_like_bool(cUNOPo->op_first));
+
case OP_ENTERSUB:
case OP_NOT: case OP_XOR:
IoLINES(io) = 0;
IoFLAGS(io) &= ~IOf_START;
do_open(gv, "-", 1, FALSE, O_RDONLY, 0, NULL);
- sv_setpvn(GvSV(gv), "-", 1);
+ if ( GvSV(gv) ) {
+ sv_setpvn(GvSV(gv), "-", 1);
+ }
+ else {
+ GvSV(gv) = newSVpvn("-", 1);
+ }
SvSETMAGIC(GvSV(gv));
}
else if (!nextargv(gv))
SV*
Perl_reg_named_buff_firstkey(pTHX_ REGEXP * const rx, const U32 flags)
{
- (void)hv_iterinit(rx->paren_names);
+ if ( rx && rx->paren_names ) {
+ (void)hv_iterinit(rx->paren_names);
- return CALLREG_NAMED_BUFF_NEXTKEY(rx, NULL, flags & ~RXapif_FIRSTKEY);
+ return CALLREG_NAMED_BUFF_NEXTKEY(rx, NULL, flags & ~RXapif_FIRSTKEY);
+ } else {
+ return FALSE;
+ }
}
SV*
BEGIN { require "./test.pl"; }
-plan(tests => 22);
+plan(tests => 23);
use File::Spec;
is($x, "foo\n", ' from just STDIN');
}
+{
+ # 5.10 stopped autovivifying scalars in globs leading to a
+ # segfault when $ARGV is written to.
+ runperl( prog => 'eof()', stdin => "nothing\n" );
+ is( 0+$?, 0, q(eof() doesn't segfault) );
+}
+
@ARGV = ('Io_argv1.tmp', 'Io_argv1.tmp', $devnull, 'Io_argv1.tmp');
while (<>) {
$y .= $. . $_;
@ARGV = ('Io_argv1.tmp', 'Io_argv2.tmp');
$^I = '_bak'; # not .bak which confuses VMS
$/ = undef;
-my $i = 6;
+my $i = 7;
while (<>) {
s/^/ok $i\n/;
++$i;
@ARGV = ();
ok( !eof(), 'STDIN has something' );
-is( <>, "ok 6\n" );
+is( <>, "ok 7\n" );
open STDIN, $devnull or die $!;
@ARGV = ();
# Do a basic test on all the tied methods of Tie::Hash::NamedCapture
-print "1..12\n";
+print "1..13\n";
+
+# PL_curpm->paren_names can be a null pointer. See that this succeeds anyway.
+'x' =~ /(.)/;
+() = %+;
+pass( 'still alive' );
"hlagh" =~ /
(?<a>.)
use strict;
use warnings;
-use Test::More tests => 107;
+use Test::More tests => 108;
# The behaviour of the feature pragma should be tested by lib/switch.t
# using the tests in t/lib/switch/*. This file tests the behaviour of
# Other things that should not be smart matched
{
my $ok = 0;
+ given(12) {
+ when( /(\d+)/ and ( 1 <= $1 and $1 <= 12 ) ) {
+ $ok = 1;
+ }
+ }
+ ok($ok, "bool not smartmatches");
+}
+
+{
+ my $ok = 0;
given(0) {
when(eof(DATA)) {
$ok = 1;
}
{
- my $ok = 1;
- given(0) {
+ my $ok = 0;
+ given("foo") {
when((1 == $ok) || "foo") {
- $ok = 0;
+ $ok = 1;
}
}
- ok($ok, '((1 == $ok) || "foo") not smartmatched');
+ ok($ok, '((1 == $ok) || "foo") smartmatched');
}