Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make guess_license_from_meta support CPAN::Meta::Spec 2.0 #17

Closed
wants to merge 3 commits into from

Conversation

tobyink
Copy link

@tobyink tobyink commented Sep 19, 2013

This takes into account the fact that the license field in 2.0 is an array, by simply allowing a "[" character before the license. Sloppy, but that seems the best way short of adding full YAML/JSON parsing to the module. (A test case is provided for this.)

It adds support for the new license strings defined in 2.0, such as "perl_5".

And it adds a new method guess_license_from_meta_code (you might want to change the name?) which bypasses the YAML/JSON parsing stuff.

@kevindawson
Copy link
Member

or better still just

do diff to LicenceUtil to issue16 as all we need is the json [

-  my ($license_text) = $meta_text =~ m{\b["']?license["']?\s*:\s*["']?([a-z_]+)["']?}gm;
-
-  return unless $license_text and my $license = $meta_keys{ $license_text };
+  my ($license_text) = $meta_text =~ m{\b["']?license["']?\s*:\s*\[?\s*["']?([a-z_]+)["']?}gm
+    or return;

applying above and issue16 is a cool solution

@magnolia-k
Copy link

I think that guess_license_from_meta_code became unnecessary since guess_license_from_meta_key was already added.

Instead, I think that the method corresponding to it is required for it since CPAN Meta spec 2 can specify two or more licenses.

I wrote method guess_license_from_meta_json.

https://github.com/magnolia-k/Software-License/tree/add_method_guess_license_from_meta_json

guess_license_from_meta_json will return a guess to each specified licenses in a hash reference format.

Please comment for this method.

@kevindawson
Copy link
Member

magnolia-k can you do a PR (pull-request) please

that is the normal way to view your code enhancement

thanks

@dolmen
Copy link
Member

dolmen commented Aug 23, 2014

This PR seems obsoleted by #28.

@karenetheridge
Copy link
Member

As noted in #39, the correct thing to do here is to use the already-provided APIs in CPAN::Meta to parse meta files, rather than doing it ourselves.

@rjbs
Copy link
Member

rjbs commented Nov 20, 2015

Closed in favor of #28

@rjbs rjbs closed this Nov 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants