This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op/taint.t: localize $@
authorKarl Williamson <public@khwilliamson.com>
Wed, 14 Dec 2011 16:36:43 +0000 (09:36 -0700)
committerKarl Williamson <public@khwilliamson.com>
Wed, 14 Dec 2011 17:56:57 +0000 (10:56 -0700)
This is so the subroutine's calling 'eval' won't affect things outside
it.

t/op/taint.t

index 39a2925..ca52f89 100644 (file)
@@ -98,6 +98,7 @@ sub taint_these (@) {
 
 # How to identify taint when you see it
 sub tainted ($) {
+    local $@;   # Don't pollute caller's value.
     not eval { join("",@_), kill 0; 1 };
 }