We don't bite newbies here... much | |
PerlMonks |
Re: Is this the most elegant way to code directory lookup?by jdporter (Paladin) |
on Sep 29, 2006 at 16:03 UTC ( [id://575566]=note: print w/replies, xml ) | Need Help?? |
I would eliminate the use of chdir. Yes, the program as given works, but only because both of the directories are specified as absolute. I think you'd gain flexibility by allowing relative paths (for example, "." as the srcdir). Here's how I might rewrite it:
This doesn't entirely avoid chdir, but it puts it at the lowest, most constrained context possible. In fact, if you have gnu tar (which it appears you do), you can exploit the -C option to make tar itself do the directory change within itself.
We're building the house of the future together.
In Section
Seekers of Perl Wisdom
|
|