From: merlyn@stonehenge•com (Randal L. Schwartz)
To: Jakub Narebski <jnareb@gmail•com>
Cc: git@vger•kernel.org, Junio Hamano <junkio@cox•net>
Subject: Re: [PATCH (amend)] gitweb: Use File::Find::find in git_get_projects_list
Date: 14 Sep 2006 14:50:24 -0700 [thread overview]
Message-ID: <86bqpi15jz.fsf@blue.stonehenge.com> (raw)
In-Reply-To: <200609141939.39406.jnareb@gmail.com>
>>>>> "Jakub" == Jakub Narebski <jnareb@gmail•com> writes:
Jakub> + sub wanted {
Jakub> + # only directories can be git repositories
Jakub> + return unless (-d $_);
Jakub> +
Jakub> + my $subdir = substr($File::Find::name, $pfxlen + 1);
Jakub> + # we check related file in $projectroot
Jakub> + if (-e "$projectroot/$subdir/HEAD") {
Jakub> + push @list, { path => $subdir };
Jakub> + $File::Find::prune = 1;
Jakub> }
Jakub> }
Jakub> - closedir($dh);
Jakub> +
Jakub> + File::Find::find({
Jakub> + follow_fast => 1, # follow symbolic links
Jakub> + dangling_symlinks => 0, # ignore dangling symlinks, silently
Jakub> + wanted => \&wanted,
Jakub> + }, "$dir");
Don't define a sub inside a sub. That's the "won't stay shared"
problem.
Move that like this:
find( {
follow_fast => 1,
dangling_symlinks => 0,
wanted => sub {
... everything in &wanted above ...
}, $dir);
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge•com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
next prev parent reply other threads:[~2006-09-14 21:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-14 6:39 [PATCH] gitweb: Use File::Find::find in git_get_projects_list Jakub Narebski
2006-09-14 7:37 ` Junio C Hamano
2006-09-14 7:59 ` Jakub Narebski
2006-09-14 9:23 ` Junio C Hamano
2006-09-14 18:32 ` Junio C Hamano
2006-09-14 18:43 ` Jakub Narebski
2006-09-14 9:40 ` Junio C Hamano
2006-09-14 10:01 ` Jakub Narebski
2006-09-14 16:42 ` Junio C Hamano
2006-09-14 17:02 ` Jakub Narebski
2006-09-14 17:12 ` Randal L. Schwartz
2006-09-14 17:39 ` [PATCH (amend)] " Jakub Narebski
2006-09-14 19:14 ` Jakub Narebski
2006-09-14 19:51 ` Junio C Hamano
2006-09-14 21:50 ` Randal L. Schwartz [this message]
2006-09-14 19:34 ` [PATCH (take 3)] " Jakub Narebski
2006-09-14 20:13 ` Junio C Hamano
2006-09-14 20:18 ` [PATCH (take 4)] " Jakub Narebski
2006-09-14 20:24 ` Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86bqpi15jz.fsf@blue.stonehenge.com \
--to=merlyn@stonehenge$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=jnareb@gmail$(echo .)com \
--cc=junkio@cox$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox