in reply to When should a wheel be reinvented
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" $
cheers
tachyon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: When should a wheel be reinvented
by theorbtwo (Prior) on Jun 30, 2004 at 05:13 UTC | |
by tachyon (Chancellor) on Jun 30, 2004 at 11:18 UTC | |
by ysth (Canon) on Jun 30, 2004 at 17:56 UTC |