summaryrefslogtreecommitdiff
path: root/lib/File/Find.pm
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-04-24 16:29:59 +0000
committerSteve Peters <steve@fisharerojo.org>2006-04-24 16:29:59 +0000
commit4c767a4e3c47151a49dd94c9e1c1cd4816054600 (patch)
treef5362707b52333253412ba175994623f4ed04190 /lib/File/Find.pm
parent668a78bfe3bf9a6d16f5b059341fb64b1e120158 (diff)
downloadperl-4c767a4e3c47151a49dd94c9e1c1cd4816054600.tar.gz
Reverting change #27953, as it appears that File::Find has
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
Diffstat (limited to 'lib/File/Find.pm')
-rw-r--r--lib/File/Find.pm15
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/File/Find.pm b/lib/File/Find.pm
index 9c81c6ad50..1f80f06b06 100644
--- a/lib/File/Find.pm
+++ b/lib/File/Find.pm
@@ -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