From: Matt S Trout Date: Mon, 15 Jun 2009 19:47:39 +0000 (+0100) Subject: demonstrate bless/cast order doesn't affect DESTROY versus magic destruction order X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FMutually-Assured-Destruction.git;a=commitdiff_plain;h=6c760df7dbe81d373e04fa8973c502068cf311ff demonstrate bless/cast order doesn't affect DESTROY versus magic destruction order --- diff --git a/notes/destruction-order.pl b/notes/destruction-order.pl index 6d465f8..2fe911e 100644 --- a/notes/destruction-order.pl +++ b/notes/destruction-order.pl @@ -25,6 +25,21 @@ my $wiz = wizard data => sub { $_[1] }, { warn "Stanza 2\n"; + + my %foo; + + my $foo = \%foo; + + cast $foo, $wiz, '$foo'; + + cast %foo, $wiz, '%foo'; + + bless($foo, 'Foo'); + +} + +{ + warn "Stanza 3\n"; my $foo = do { my %foo;