There's more than one way to do things | |
PerlMonks |
Re^3: (Perl6) Groking Continuations (_!)by tye (Sage) |
on Apr 08, 2003 at 21:45 UTC ( [id://249087]=note: print w/replies, xml ) | Need Help?? |
You've managed to lose another side effect. With your version, I can't use -x _ to see if the file that the iterator just handed to me is executable. I'd have to do another stat rather than using the results of the lstat that Perl so helpfully caches for me. So you compressed all of the different items from the stack into two stacks that you keep handy using a closure (rather than a more tradition Perl object). I like it. I agree that the chdir side-effect is problematic. Too bad Unix didn't provide an efficient way to save/restore chdir context (based on i-node instead of on a path string). I'd make the chdir optional with appropriate disclaimers in the documentation but that defeats the purpose of providing a simple example. I think I'll try this technique on File::KGlob::unbrac (well, using a closure would be cheating since those subroutines are still Perl4-compatible code, though). (: Thanks for the demonstration. - tye
In Section
Seekers of Perl Wisdom
|
|