At 1:06 PM -0400 4/18/02, Chris Nandor wrote:
>At 09:46 -0700 2002.04.18, Bruce Van Allen wrote:
>>I'd love to hear about hidden traps or alternatives.
>
>Hidden trap, sorta:
>
>> local @ARGV = grep { -f and !/^\./ and m/$PATTERN/ } readdir DIR
>> or die "No files to duplicate";
>
>On Mac OS, it is often useful to add:
> and $_ != "Icon\015"
>or somesuch. Those files get in the way a lot.
Thanks. The next step in my line-end conversion utility filters out
binaries, but it would be better to catch these beforehand. On Mac OS
is there one of these for every (user-visible) item in a directory?
>As for the rest, it seems fine, except for the unnecessary $SEP stuff.
>Just replace it with "use File::Spec::Functions' and then:
>
>
>> local $^I = "$DESTINATION_DIR$SEP*";
>
> local $^I = catfile($DESTINATION, '*');
Ahh. File::Spec does it after all -- why did I think it wouldn't cat
the '*"? I just tested this in my utility script in Perl under OS X
and MacPerl 5.6.1r1 -- and it works. Adds the majority of a second to
load File::Spec::Functions and call catfile three different times,
but that's irrelevant in this application. OK Chris, I'm 100%
converted:
At 2:22 PM -0400 4/17/02, Chris Nandor wrote:
>Praise be File::Spec and its authors! :)
Halleluja!
1;
--
- Bruce
__bruce_van_allen__santa_cruz_ca__