[prev in list] [next in list] [prev in thread] [next in thread]
List: mason-cvs
Subject: [Mason-checkins] CVS: mason/dist/lib/HTML/Mason Tools.pm,1.67,1.68
From: Dave Rolsky <autarch () users ! sourceforge ! net>
Date: 2003-05-24 22:36:17
[Download RAW message or body]
Update of /cvsroot/mason/mason/dist/lib/HTML/Mason
In directory sc8-pr-cvs1:/tmp/cvs-serv4986
Modified Files:
Tools.pm
Log Message:
make taint mode check cached
add comment about how fragile this is
Index: Tools.pm
===================================================================
RCS file: /cvsroot/mason/mason/dist/lib/HTML/Mason/Tools.pm,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- Tools.pm 24 May 2003 20:33:22 -0000 1.67
+++ Tools.pm 24 May 2003 22:36:15 -0000 1.68
@@ -181,21 +181,28 @@
return 1;
}
-my $Taint;
+# This code seems to be very fragile! Please don't check in changes
+# unless you've tested it with Perl 5.00503, 5.6.1, and 5.8.0
+my $TaintIsOn;
sub taint_is_on
{
- return $Taint if defined $Taint;
+ return $TaintIsOn if defined $TaintIsOn;
+ return $TaintIsOn = _taint_is_on();
+}
+sub _taint_is_on
+{
if ( $] >= 5.008 )
{
# We have to eval a string because this variable name causes
# earlier Perls to not compile at all.
- return $Taint = eval '${^TAINT}';
+ return eval '${^TAINT}' ? 1 : 0;
}
else
{
local $^W;
- return eval { $Taint = 0; local $^W; "$0$^X" && kill 0; $Taint = 1 };
+ eval { "$0$^X" && kill 0; 1 };
+ return $@ ? 1 : 0;
}
}
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
_______________________________________________
Mason-checkins mailing list
Mason-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-checkins
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic