In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/474af99058f4c0fc3b80d73763da5b29c1ff8c66?hp=a12cf05f80a65e40fe339b086ab2d10e18d838c1>
- Log ----------------------------------------------------------------- commit 474af99058f4c0fc3b80d73763da5b29c1ff8c66 Author: Florian Ragwitz <[email protected]> Date: Fri Oct 15 19:34:52 2010 +0200 Make splice invoke set magic ----------------------------------------------------------------------- Summary of changes: pp.c | 4 ++++ t/op/splice.t | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletions(-) diff --git a/pp.c b/pp.c index a1558de..b777f39 100644 --- a/pp.c +++ b/pp.c @@ -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 1ffcb49..93718a1 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"; -- Perl5 Master Repository
