jhthorsen / jhthorsen/json-validator

Hard runtime dependency on Net::IDN::Encode breaks install on perl >= 5.38 (XS won't compile)

Open
#296 1 comment 1 reaction 1 assignee Claimed by @tobez View on GitHub
bug help wanted
Dominant language
Perl
Stars
60
Forks
64
PR merge metrics
No merged PRs in 30d

Description

Since v5.16 (#283), `Net::IDN::Encode` is declared as an unconditional
runtime `requires`. That module's latest release (2.500, from 2018) fails
to compile its XS on **perl >= 5.38**, so a clean `cpanm JSON::Validator`
on a modern perl now fails at the dependency build:

lib/Net/IDN/Punycode.xs:256:19: error: implicit declaration of function
'uvuni_to_utf8_flags'; did you mean 'uvchr_to_utf8_flags'?
[-Wimplicit-function-declaration]

`uvuni_to_utf8_flags` was removed from the Perl C API in 5.38.0 ("Removed
many deprecated C functions"), so the object file no longer builds under
modern compilers (where the implicit declaration is an error). CPAN Testers
confirms FAILs for Net-IDN-Encode 2.500 on 5.38 / 5.40 / 5.42:
https://api.cpantesters.org/v3/summary/Net-IDN-Encode/2.500

Net::IDN::Encode itself is effectively unmaintained — the fix has been known
since 2023 but sits in unmerged PRs (cfaerber/Net-IDN-Encode#11, #12) — so
this dependency cannot reliably be installed on a current perl today.

This doesn't show up in JSON::Validator's own CPAN Testers matrix (all green
on 5.38–5.42), for two reasons: smokers either already have a distro-packaged
(patched) Net::IDN::Encode so the XS never compiles during the JV smoke, or
the module is simply absent and `Formats.pm` degrades gracefully (warns +
treats the format as valid). So the smoke matrix masks the breakage that a
from-scratch install hits.

**Suggested fix:** the runtime never hard-needs these modules — `Formats.pm`
already `eval 'require ...'`s `Net::IDN::Encode`, `Data::Validate::Domain`,
and `Data::Validate::IP` and falls back via `_module_missing` when they're
absent. The original report (#283) was about the *test suite* skipping
silently, which is a `TEST_REQUIRES` concern, not a runtime one. Moving these
three from runtime `requires` to `test_requires` (or back to `recommends`)
would fix #283's actual complaint without forcing every installer to build an
XS module that no longer compiles on supported perls.

- Perl: 5.42.0
- JSON::Validator: 5.16–5.18
- Net::IDN::Encode: 2.500

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.