summaryrefslogtreecommitdiff
path: root/pod/perlobj.pod
diff options
context:
space:
mode:
authorMike Guy <mjtg@cam.ac.uk>2006-01-03 19:18:41 +0000
committerSteve Peters <steve@fisharerojo.org>2006-01-03 20:03:49 +0000
commitf4551fcd8535f92b446c0bbb84dfd670a1f3eece (patch)
treec6b4c6c1d9ba9a0a8f8f5a2e228e8468068cb6c4 /pod/perlobj.pod
parente5ce394ccbcb3ef5a450374c9a26bafe8a88dfa7 (diff)
downloadperl-f4551fcd8535f92b446c0bbb84dfd670a1f3eece.tar.gz
Re: [perl #38034] A combination eval, DESTROY method and $@ - dangerous - bug
Message-Id: <E1Etrg9-0005XE-LZ@libra.cus.cam.ac.uk> p4raw-id: //depot/perl@26625
Diffstat (limited to 'pod/perlobj.pod')
-rw-r--r--pod/perlobj.pod5
1 files changed, 5 insertions, 0 deletions
diff --git a/pod/perlobj.pod b/pod/perlobj.pod
index bcf56a7a1c..6cfa20ce8e 100644
--- a/pod/perlobj.pod
+++ b/pod/perlobj.pod
@@ -456,6 +456,11 @@ manipulating C<$_[0]> within the destructor. The object itself (i.e.
the thingy the reference points to, namely C<${$_[0]}>, C<@{$_[0]}>,
C<%{$_[0]}> etc.) is not similarly constrained.
+Since DESTROY methods can be called at unpredictable times, it is
+important that you localise any global variables that the method may
+update. In particular, localise C<$@> if you use C<eval {}> and
+localise C<$?> if you use C<system> or backticks.
+
If you arrange to re-bless the reference before the destructor returns,
perl will again call the DESTROY method for the re-blessed object after
the current one returns. This can be used for clean delegation of