[perl #97632] Improve SvTAINT docs
authorFather Chrysostomos <sprout@cpan.org>
Sat, 26 Nov 2011 20:42:55 +0000 (12:42 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 26 Nov 2011 22:33:47 +0000 (14:33 -0800)
Copied almost verbatim from text supplied by Kevin Ryde.

sv.h
t/op/substr.t

diff --git a/sv.h b/sv.h
index 360a249..ca15254 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1374,7 +1374,11 @@ standard perl fashion, via a carefully crafted regexp, rather than directly
 untainting variables.
 
 =for apidoc Am|void|SvTAINT|SV* sv
-Taints an SV if tainting is enabled.
+Taints an SV if tainting is enabled, and if some input to the current
+expression is tainted--usually a variable, but possibly also implicit
+inputs such as locale settings.  C<SvTAINT> propagates that taintedness to
+the outputs of an expression in a pessimistic fashion; i.e., without paying
+attention to precisely which outputs are influenced by which inputs.
 
 =cut
 */
index 2673fc7..1dd9ba4 100644 (file)
@@ -23,7 +23,7 @@ $SIG{__WARN__} = sub {
 
 BEGIN { require './test.pl'; }
 
-plan(360);
+plan(361);
 
 run_tests() unless caller;
 
@@ -42,6 +42,8 @@ eval{substr($a,999,999) = "" ; };# P R Q S
 like ($@, $FATAL_MSG);
 is(substr($a,0,-6), 'abc');  # P=Q R S
 is(substr($a,-3,1), 'x');    # P Q R S
+sub{$b = shift}->(substr($a,999,999));
+is ($w--, 1, 'boundless lvalue substr only warns on fetch');
 
 substr($a,3,3) = 'XYZ';
 is($a, 'abcXYZxyz' );