in reply to Copy Permissions
Keeping that in mind, I would change your die "Usage..." unless @ARGV == 2; to a slightly different idiom.
@ARGV == 2 or die "Usage.....";
Now you've got the condition of death right up front so that a reader will see what's triggering the death; too many elements in @ARGV. This is the same approach commonly used with file open. You will find a strong recommendation in that direction for mostly the same reasons I've given in perlstyle. But to be fair, this is a gray area, and you do see it both ways all the time.
I also don't like the notion of setting up aliases to $File::Find::name using typeglobs. These variables are read-only according to the POD for File::Find. When you start aliasing them, you might not remember that $name is special, and shouldn't be modified.
I would much rather just see you checking $File::Find::name directly, or assigning its value to a lexical $name.
The next thing that bothers me is in your $wanted->() sub. You're not checking for the validity of your pattern match, and then you're subsequently relying on $2 to contain a reasonable value. Don't rely on captures unless you're certain that there was a match. Just don't; you will get into trouble eventually with that approach.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Copy Permissions
by BuddhaNature (Beadle) on Apr 26, 2004 at 16:10 UTC | |
by davido (Cardinal) on Apr 26, 2004 at 23:01 UTC |