Content deleted Content added
→Perl 5: Linked to https://stackoverflow.com/a/10343025 in the interim due to dead link. —DIV |
m Dating maintenance tags: {{Deadlink}} |
||
Line 802:
The forms shown above can sometimes fail if the global variable {{Perl2|$@}} is changed between when the exception is thrown and when it is checked in the {{Perl2|if ($@)}} statement. This can happen in multi-threaded environments, or even in single-threaded environments when other code (typically
called in the destruction of some object) resets the global variable before the checking code.
The following example shows a way to avoid this problem (see [http://www.perlfoundation.org/perl5/index.cgi?exception_handling]{{deadlink|date=October 2020}} or [https://stackoverflow.com/a/10343025]). But at the cost of not being able to use return values:
<syntaxhighlight lang="perl">
|