diff options
-rw-r--r-- | pp.c | 4 | ||||
-rw-r--r-- | t/op/splice.t | 12 |
2 files changed, 15 insertions, 1 deletions
@@ -5347,6 +5347,10 @@ PP(pp_splice) *MARK = &PL_sv_undef; Safefree(tmparyval); } + + if (SvMAGICAL(ary)) + mg_set(MUTABLE_SV(ary)); + SP = MARK; RETURN; } diff --git a/t/op/splice.t b/t/op/splice.t index 1ffcb498a7..93718a15cb 100644 --- a/t/op/splice.t +++ b/t/op/splice.t @@ -1,6 +1,6 @@ #!./perl -print "1..18\n"; +print "1..20\n"; @a = (1..10); @@ -82,3 +82,13 @@ print "ok 17\n"; splice( @a, 1, 2, $a[1], $a[1] ); print "not " unless j(@a) eq j(1,2,2); print "ok 18\n"; + +# splice should invoke get magic + +print "not " if Foo->isa('Bar'); +print "ok 19\n"; + +splice @Foo::ISA, 0, 0, 'Bar'; + +print "not " if !Foo->isa('Bar'); +print "ok 20\n"; |