The patch is pretty trivial (minimal testing but don't see why it should not be stable). The value of $_ is saved and restored so you can change/use it in &wanted with impunity. Note as we are passing 3 values to the &wanted every time there will be a slowdown but this is probably (speculation) trivial compared to iterating over the directory tree.
$ diff Find.pm FindPatch.pm
1c1
< package File::Find;
---
> package File::FindPatch;
394c394
< { &$wanted_callback }; # protect against wild "next"
---
> { my $save=$_; &$wanted_callback($save,$name,$dir); $_=$
+save }; # protect against wild "next"
450c450
< { &$wanted_callback }; # protect against wild "next"
---
> { my $save=$_; &$wanted_callback($save,$name,$dir); $_=$
+save }; # protect against wild "next"
495c495
< { &$wanted_callback }; # protect against wild "next"
---
> { my $save=$_; &$wanted_callback($save,$name,$dir); $_
+=$save }; # protect against wild "next"
519c519
< { &$wanted_callback }; # protect against wild
+"next"
---
> { my $save=$_; &$wanted_callback($save,$name,$
+dir); $_=$save }; # protect against wild "next"
525c525
< { &$wanted_callback }; # protect against wild "nex
+t"
---
> { my $save=$_; &$wanted_callback($save,$name,$dir)
+; $_=$save }; # protect against wild "next"
$
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|