There are quite a few CPAN dists on github that don't have the repo listed in the metadata. This post shows how to fix that for a dist that uses Module::Install. I hit various problems, so I'm writing down these notes for next time, and so that people can correct anything I got wrong.
I've never used Module::Install (MI from here on) and I've avoided doing this sort of PR on dists using it in the past. But yesterday I thought "how hard can it really be?", and the answer was "harder than it should have been, but easy once you know the trick". Kind of sums up much of programming, really :-)
The main thing I knew about MI was that it creates
an inc/
directory in the top-level of your distribution,
which contains MI and any other plugins you're using.
This means that someone installing your module doesn't need to install
MI first: batteries included.
I forked the repo, then went to Gabor's article, which says how to add the repo to a dist's metadata, for the different builders. It says you just ad the following line:
repository 'https://github.com/flathead/Zork';
So then I ran perl Makefile.PL
and checked the META.yml
.
Hmm, still not there.
Okay, maybe it gets updated when you build the dist? So I tried:
perl Makefile.PL
make dist
... and had a look at META.yml
in the tarball. Nope, still no joy.
I asked on the #toolchain
channel on IRC, and it was suggested that
I look at other dists that are using MI.
A good suggestion.
The one I looked at is using Module::Install::GithubMeta;
you add the following line to your Makefile.PL
:
githubmeta();
This sets both the repository
and homepage
entries in the metadata,
where the repository()
command just sets repository
field,
as you might expect.
I ran perl Makefile.PL
, still no repo in the META.yml
,
so I tried building the tarball again, but no joy.
Most of the time you don't want to have META.yml
in github,
so I tried deleting it. But when I ran perl Makefile.PL
I got
a warning about META.yml
not existing. So I removed it from MANIFEST
as well. This time I didn't get a META.yml
.
At this point I gave up and emailed BINGOS, the current maintainer of MI, asking for help.
The key thing I needed to do was
Remove the
inc/
directory from the github repo
MI adds the inc
directory to the release tarball,
but it doesn't need it in the (author's) source directory.
Or rather, I guess the lack of the inc
directory tells MI
that you're an author not an installer?
Furthermore:
Remove
META.yml
from gitub, but leave it inMANIFEST
.
MI will generate META.yml for you, but only if it's
listed in MANIFEST
. You'll get a warning about META.yml
not existing, but ignore that.
As you can tell, I've only somewhat improved my understanding of MI, but I could get the PR done.
comments powered by Disqus