Subject: | prereq_matches_use complains about fallback module |
Unfortunately, even after #35092 was resolved,
http://cpants.perl.org/dist/kwalitee/WebService-NFSN still shows it
failing prereq_matches_use. Now, the problem is this bit of code:
BEGIN
{
## no critic ProhibitStringyEval
eval "use JSON::XS ();";
if ($@) {
# Can't find JSON::XS, try JSON (2.0 or later):
eval "use JSON qw(decode_json); 1" or die $@;
} else {
if ($JSON::XS::VERSION >= 2) {
*decode_json = \&JSON::XS::decode_json;
} else {
*decode_json = \&JSON::XS::from_json; # old name for decode_json
} # end else found JSON::XS prior to version 2.0
} # end else we were able to load JSON::XS
} # end BEGIN
Here, I'm trying to use JSON::XS (which is listed in "requires"), and
falling back to JSON if necessary. But prereq_matches_use thinks both
JSON::XS and JSON are required.
I'm not sure how this can be resolved, short of adding a "fallbacks"
section to META.yml. JSON doesn't belong in "requires" or "recommends".