File tree 2 files changed +30
-2
lines changed
2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -3522,9 +3522,11 @@ PP(pp_index)
3522
3522
if (PL_op -> op_private & OPpTRUEBOOL ) {
3523
3523
PUSHs ( ((retval != -1 ) ^ cBOOL (PL_op -> op_private & OPpINDEX_BOOLNEG ))
3524
3524
? & PL_sv_yes : & PL_sv_no );
3525
- if (PL_op -> op_private & OPpTARGET_MY )
3525
+ if (PL_op -> op_private & OPpTARGET_MY ) {
3526
3526
/* $lex = (index() == -1) */
3527
3527
sv_setsv (TARG , TOPs );
3528
+ SETTARG ;
3529
+ }
3528
3530
}
3529
3531
else
3530
3532
PUSHi (retval );
Original file line number Diff line number Diff line change 8
8
}
9
9
10
10
use strict;
11
- plan( tests => 412 );
11
+ plan( tests => 414 );
12
12
13
13
run_tests() unless caller ;
14
14
@@ -332,4 +332,30 @@ sub run_tests {
332
332
333
333
}
334
334
335
+ {
336
+ my $store = 100;
337
+ package MyTie {
338
+ require Tie::Scalar;
339
+ our @ISA = qw( Tie::StdScalar) ;
340
+ sub STORE {
341
+ my ($self , $value ) = @_ ;
342
+
343
+ $store = $value ;
344
+ }
345
+ };
346
+ my $x ;
347
+ tie $x , " MyTie" ;
348
+ $x = (index (" foo" , " o" ) == -1);
349
+ ok(!$store , ' magic called on $lexical = (index(...) == -1)' );
350
+ }
351
+ {
352
+ is(eval <<'EOS' , " a" , ' optimized $lex = (index(...) == -1) is an lvalue' );
353
+ my $y = "foo";
354
+ my $z = "o";
355
+ my $x;
356
+ ($x = (index($y, $z) == -1)) =~ s/^/a/;
357
+ $x;
358
+ EOS
359
+ }
360
+
335
361
} # end of sub run_tests
You can’t perform that action at this time.
0 commit comments