in reply to Struggle with Test::CPAN::Meta

G'day szabgab,

I encountered a similar issue recently where I was adding META.yml and META.json to MANIFEST. My tests using ExtUtils::Manifest failed because those files weren't present. Like you, I realised that the files were generated by make dist, added to the tarball, then distdir was deleted: still no META.* in the development directory — either before or after make test is run.

I took a very pragmatic approach to this. make dist not only creates those files, but also adds their names to MANIFEST. So I removed my hand-crafted entries from MANIFEST and make test ran successfully. Anyone unpacking the tarball, has both the files present and the entries in MANIFEST: again, make test runs successfully.

That doesn't directly help you, as you actually want those files to be available in your development directory when you run make test.

I had a look through the test-class/t in your git repo. I couldn't see anything that looked like test_meta.t — and wasn't prepared to look through several screenfuls of *.t files — so I'll just make a general suggestion.

In test_meta.t (or whatever it's called) add a SKIP: {...} block that tests for the presence for META.*: now make test should run successfully. After make dist, unpack the tarball, which should give you a directory with the META.* files and entries for them in MANIFEST. Now run the standard incantation, perl Makefile.PL; make; make test, and hopefully tests are either successful or point to something you need to fix. When everything is good; post the tarball to CPAN.

There's potentially a more elegant solution which involves adding a sub MY::postamble {...} to Makefile.PL to generate a local_metafile (or similar) make target. That seems like a lot of work, but may be worth it depending on your requirements. My expertise with ExtUtils::MakeMaker is not at a level that I feel I can usefully provide you with any substantial help — perhaps another monk can offer advice.

A bit of bonus humour. When typing the first paragraph, my finger clipped the 'E' when aiming for the 'S': I ended up writing "My testes ...". I'm very glad I spotted that. 😌

Update: I've made multiple, extremely minor changes to last sentence of the penultimate paragraph. None of these change the intended meaning; they're just better English. As there's been no responses, at the time of writing, these do not affect anyone's reply. It'd be great if there was a "Preview" option for this. I'll post separately about that. Update: Done - see "Preview for Post Editing"

— Ken

Replies are listed 'Best First'.
Re^2: Struggle with Test::CPAN::Meta
by szabgab (Priest) on Feb 22, 2021 at 15:53 UTC
    Thanks Ken. It is actually in the xt/ directory, now the only one that was left there. The others were already moved to the t/ directory.