This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Reverting change #27953, as it appears that File::Find has
authorSteve Peters <steve@fisharerojo.org>
Mon, 24 Apr 2006 16:29:59 +0000 (16:29 +0000)
committerSteve Peters <steve@fisharerojo.org>
Mon, 24 Apr 2006 16:29:59 +0000 (16:29 +0000)
localized the C<$_> usable by the wanted function since
version 1.04 (change #18501, to be exact).  Update the
docs to express this change.  Finally, bump the version.
p4raw-link: @27953 on //depot/perl: 668a78bfe3bf9a6d16f5b059341fb64b1e120158
p4raw-link: @18501 on //depot/perl: 17ab9c147afa44f9f620bca432b3948e42711043

p4raw-id: //depot/perl@27954

lib/File/Find.pm

index 9c81c6a..1f80f06 100644 (file)
@@ -215,6 +215,9 @@ through a collection of variables.
 
 =back
 
+The above variables have all been localized and may be changed without
+effecting data outside of the wanted function.
+
 For example, when examining the file F</some/path/foo.ext> you will have:
 
     $File::Find::dir  = /some/path/
@@ -237,18 +240,6 @@ table below summarizes all variants:
               /etc               /                 /etc
               /etc/x             /etc              /etc/x
 
-Do not modify these variables. If you want to use C<$_>, it must
-be restored to its initial value before returning from the
-function. C<local> may be used for this purpose:
-
-  sub callback {
-    open my $fh, '<', $_ or die "Cannot open $_ for input: $!\n";
-    local $_; # localize $_ for the remainder of the routine
-    while (<$fh>) {
-      # manipulate $_
-    }
-    # $_ will be restored upon leaving
-  }
 
 When <follow> or <follow_fast> are in effect, there is
 also a C<$File::Find::fullname>.  The function may set