projects
/
p5sagit/Mutually-Assured-Destruction.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
demonstrate self saving during DESTROY
[p5sagit/Mutually-Assured-Destruction.git]
/
notes
/
save-my-life.pl
diff --git a/notes/save-my-life.pl
b/notes/save-my-life.pl
new file mode 100644
(file)
index 0000000..
2e1e748
--- /dev/null
+++ b/
notes/save-my-life.pl
@@ -0,0
+1,18
@@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+my %objs;
+
+BEGIN {
+ package Foo;
+
+ sub DESTROY { warn "DESTROY\n"; $objs{$_[0]} = $_[0]; }
+}
+
+{
+ bless({}, 'Foo');
+}
+
+warn join(', ', %objs);