metacpan-api icon indicating copy to clipboard operation
metacpan-api copied to clipboard

Add metadata to identify pure perl and XS distributions

Open melo opened this issue 14 years ago • 13 comments

This would be useful information to have on the distribution page.

melo avatar Jun 15 '11 15:06 melo

Hi,

is it enough to look for XSLoader as dependency? I don't know much about XS, so please enlighten me :)

monken avatar Jun 16 '11 16:06 monken

I don't know either :), I'll try and find out.

melo avatar Jun 16 '11 16:06 melo

http://deps.cpantesters.org/ shows whether a module is not pure-perl. The criteria are explained in A Brief Note on Purity warnings, the source implementing this is somewhere in http://www.cantrell.org.uk/cgit/cgit.cgi/cpandeps/.

daxim avatar Jul 20 '11 15:07 daxim

@pjcj Is this something that cpancover.com could provide? This would be along the lines of the deps discussion we had elsewhere.

oalders avatar Oct 08 '14 04:10 oalders

cpancover.com could fairly easily say whether or not any C or XS code was executed during the coverage run of the module. But, as with the deps discussion, that would relate only to the actual runs on the cpancover.com server. It's quite possible that a module with a part that would be either XS or pure perl was run with just the pure perl part on cpancover. Then that module would be reported as pure perl. So I'm not sure whether that would be an improvement on the cpantesters heuristics. I suspect not. Though, I suppose it could find modules which use C that cpantesters hadn't found.

If this is thought to be sufficiently useful I'd be happy to add a field to the json file. But I would imagine that getting the data from cpantesters would be the better bet.

pjcj avatar Oct 11 '14 20:10 pjcj

@DrHyde, where we would find this logic in https://github.com/DrHyde/CPANdeps ?

oalders avatar Dec 17 '14 04:12 oalders

https://github.com/DrHyde/CPANdeps/blob/master/lib/CPANdeps.pm#L469 and the next few lines.

The heuristic is that it's not pure-perl if there's a .swg, .xs, .c, .h, or .i file in the MANIFEST and there's no file with 'PurePerl' in its name, or if it depends on any Inline::* module. The MANIFEST parser is somewher, errm, naive.

DrHyde avatar Dec 17 '14 12:12 DrHyde

@neilbowers can you think of an existing tool on CPAN where we should add this functionality or do you think it would be better as its own module? Maybe Parse::LocalDistribution?

oalders avatar Dec 17 '14 14:12 oalders

I already have a dist that grovels over the contents of a tarball, mostly bard on PAUSE code. That would probably be an appropriate place.

DrHyde avatar Dec 17 '14 14:12 DrHyde

@DrHyde great. Which dist is this?

oalders avatar Dec 17 '14 15:12 oalders

@oalders Module::Inspector is my first thought, also maybe Module::ParseDeps. I think the former is probably the most appropriate place.

neilb avatar Dec 17 '14 17:12 neilb

@oalders sorry, I was on my phone and looking it up would have been a pain in the arse. https://metacpan.org/pod/CPAN::ParseDistribution

DrHyde avatar Dec 18 '14 20:12 DrHyde

I've proposed some metadata extensions https://github.com/Perl-Toolchain-Gang/CPAN-Meta/issues/82 which would (among other things) allow CPAN authors to easily and authoritatively state "this dist requires a compiler", so that if such a field is present, it can be taken verbatim instead of relying purely on heuristics.

Obviously even once such a mechanism exists it doesn't "solve" this problem, but adds a useful place to override false-positive and false-negative conditions without having to add special cases in whatever the sniffer is.

kentfredric avatar Jan 11 '15 06:01 kentfredric