Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CF: Problem with collect.pl
I looked this up in the perl 5 book and it mentions details with
the input operator <> and using it for file globbing. It mentions
that the shell gets involved and other issues.
Anyway, the below should always work and be faster.
- foreach $file (<$dir/*>) {
+ opendir(THISDIR, $dir);
+ local(@allfiles) = readdir(THISDIR);
+ closedir(THISDIR);
+ foreach $file (@allfiles) {
> I've encountered some problems while trying to build archetypes: The
> collect.pl script fails to scan the arch tree.
>
> My platform is Linux 2.0.35 with Slackware 3.5 distribution.
> The perl in the dist is "version 5.004_04 built for i586-linux".
>
> I have next-to-nothing knowledge of perl but I managed to kludge it to
> work with following patch. (Uses 'echo' instead of perls own system...)
>
> --- collect.pl.orig Sat Aug 1 10:23:59 1998
> +++ collect.pl Mon Aug 10 12:15:58 1998
> @@ -43,7 +43,8 @@
> sub traverse {
> local($dir) = shift;
> local($file,$name);
> - foreach $file (<$dir/*>) {
> + local($string) = readpipe "echo $dir/*";
> + foreach $file (split(' ',$string)) {
> $name = &basename($file,""); # DIR
> if( -d $file && $name ne "dev" && $name ne "trashbin") {
> &traverse($file);
>
> I would appreciate a more elegant solution.
>
> - Riba
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to crossfire-request@ifi.uio.no]
Follow-Ups: