On 9/22/07, Michael G Schwern <[EMAIL PROTECTED]> wrote:
> Here's the problem.  "no_index" allows me to blot out whole directory trees
> and individual files.  "provides" allows me to specify individual files.

But the two keys do different things.

"provides" maps a package name to a filename and, optionally, a
version number.  A smart enough tool could potentially map multiple
packages to a single filename, with different version information for
each.  (I'm not sure if M::B or EU::MM do this today).  In other
words, "provides" is metadata about package names.

By contract, "no_index" just contains exclusion lists of types of
object (dirs, files, packages and namespaces -- and I'm not clear on
the difference of the last two, unless the latter is recursive).
That's not package metadata in the same way.

It would be more logical to me to have an "index" directive that is
the counterpart of "no_index" and then specific rules to govern the
conflict.  E.g. one trumps the other, or the most specific trumps (so
that "index" a dir, but "no_index" a file inside the dir indexes the
dir but excluding the file).

> Trouble is I have an enormous subdirectory full of files.
> http://search.cpan.org/src/MSCHWERN/Alien-SVN-1.4.5.2/src/subversion-1.4.5/
>
> Most of it should not be indexed, but buried deep down in there is a handful
> of Perl modules which should be.  Crafting a "no_index" that excludes
> everything but these modules is a royal pain in the ass.  So I've said:

Well, it makes for a META.yml that's a pain, but in Build.PL, I think
this works:

use File::Find;
my @no_index_files;
find sub {
    return unless -f;
    return if $File::Find::name =~
        m{^src/subversion-[0-9.]+/subversion/bindings/swig/perl/native/.+\.pm};
    push @no_index_files, $File::Find::name;
} => "src";

And then later:

    no_index => {
        directory => ['inc'],
        file => [ @no_index_files ],
    },

> I don't think setting no_index on API.pm is necessary as search will favor a
> Foo.pod over a Foo.pm for displaying docs, just like perldoc.

But I want CPAN::Reporter::API to show up in the Documentation
section, not Modules, because there is no actual code in the API.pm
file.

> In fact, since CPAN::Reporter::API should be in the 02module index, it is
> contradictory to say a file provides a package and also that file should not
> be indexed.

That's arguable.  I could probably just add the pure doc .pm files to
MANIFEST.SKIP and get the same effect in the end.

Regards,
David

Reply via email to