Re: [PATCHv5 08/17] gitweb: Add optional output caching
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Oct 6, 2010, 23:16 UTC
- Message-ID
- <AANLkTi=Z6i-89mW8Gom3QQa8R1puV+wksNmh029GaUjS@mail.gmail.com>
- In-Reply-To
- <201010070106.30864.jnareb@gmail.com>
On Wed, Oct 6, 2010 at 23:06, Jakub Narebski <jnareb@gmail.com> wrote:
Show 16 quoted lines
> On Thu, 7 Oct 2010, Ævar Arnfjörð Bjarmason wrote:
>> On Wed, Oct 6, 2010 at 22:01, Jakub Narebski <jnareb@gmail.com> wrote:
>>
>> > + $cache ||= 'GitwebCache::SimpleFileCache';
>> > + eval "require $cache";
>>
>> Just:
>>
>> eval { require $cache };
>>
>> Instead?
>
> Wouldn't work correctly. We want to use 'require BAREWORD' version,
> where BAREWORD is name of module, e.g. GitwebCache::SimpleFileCache,
> and which makes Perl to search for GitwebCache/SimpleFileCache.pm
> in @INC.Ah, I've been using perl5i too much :)
> Well, we could insert hooks into @INC, but I don't think we want to use > such hack.
There's also:
eval {
my $path = $cache;
$path =~ s[::][/]g;
$path .= ".pm";
require $path;
};But at that point it's probably easier just to use string eval. Unless there's a performance issue (very unlikely).