Summary
HTTP::BrowserDetect 3.45 exposes a remaining PerlOnJava scalar-semantics regression: numeric zero returned by browser-version methods is considered different from the string "0" loaded from the JSON fixture.
CPAN evidence
- Distribution:
HTTP-BrowserDetect 3.45
- CPAN run:
20260904-185312-10032
- Failing test:
t/01-detect.t
- PerlOnJava result: 304 user-agent cases fail before the harness timeout
- System Perl result: all 6 test files pass, 2,601 tests successful
The CPAN record reports a timeout because the test contains 1,220 user-agent cases and the failure stream eventually exceeds the harness limit. The timeout is secondary; the failures are deterministic and begin immediately.
Minimal reproducer
The underlying comparison fails on both PerlOnJava backends but passes under system Perl:
use Test::Differences qw(eq_or_diff);
eq_or_diff(0, "0", "numeric zero and string zero");
The same mismatch is exercised by HTTP::BrowserDetect:
my $detected = HTTP::BrowserDetect->new($user_agent);
eq_or_diff($detected->browser_major, "0", "browser_major");
For user agents with no detected browser version, HTTP::BrowserDetect::_init_version assigns numeric 0, while the JSON fixture contains the string value "0". Standard Perl's scalar dual-value behavior allows the comparison; PerlOnJava's Test::Differences sees distinct numeric and string scalar types.
Impact
This affects pure-Perl modules and tests that compare values originating from different sources—such as computed numeric values versus strings decoded from JSON. It can create large numbers of false incompatibilities in data-driven CPAN test suites, and can turn a broad semantic mismatch into a harness timeout.
Related issues
- #1158 — closed issue on preserving string scalar semantics through arithmetic.
- #1128 — closed issue on Perl-compatible numeric-zero scalar behavior.
- #1260 — JSON numeric scalar typing in the opposite direction, where decoded numbers lose numeric behavior.
This issue should be evaluated alongside those fixes rather than assuming that closing them eliminated all scalar dual-value mismatches.
Required regression coverage
Before closing this issue, add tracked project-owned tests that:
- Compare numeric zero and string
"0" through the same deep-comparison path used by Test::Differences.
- Cover values returned from a pure-Perl method after numeric initialization and values decoded from JSON fixtures.
- Verify ordinary numeric and string comparisons remain distinct where Perl distinguishes them.
- Pass under standard Perl first, then pass on both the JVM and interpreter backends.
- Include a focused
HTTP::BrowserDetect or equivalent data-driven regression so the CPAN failure cannot silently return.
Do not fix this by weakening Test::Differences globally or by changing the upstream fixture. The implementation must preserve Perl-compatible scalar behavior at the value/operation boundary.
Summary
HTTP::BrowserDetect3.45 exposes a remaining PerlOnJava scalar-semantics regression: numeric zero returned by browser-version methods is considered different from the string"0"loaded from the JSON fixture.CPAN evidence
HTTP-BrowserDetect3.4520260904-185312-10032t/01-detect.tThe CPAN record reports a timeout because the test contains 1,220 user-agent cases and the failure stream eventually exceeds the harness limit. The timeout is secondary; the failures are deterministic and begin immediately.
Minimal reproducer
The underlying comparison fails on both PerlOnJava backends but passes under system Perl:
The same mismatch is exercised by
HTTP::BrowserDetect:For user agents with no detected browser version,
HTTP::BrowserDetect::_init_versionassigns numeric0, while the JSON fixture contains the string value"0". Standard Perl's scalar dual-value behavior allows the comparison; PerlOnJava'sTest::Differencessees distinct numeric and string scalar types.Impact
This affects pure-Perl modules and tests that compare values originating from different sources—such as computed numeric values versus strings decoded from JSON. It can create large numbers of false incompatibilities in data-driven CPAN test suites, and can turn a broad semantic mismatch into a harness timeout.
Related issues
This issue should be evaluated alongside those fixes rather than assuming that closing them eliminated all scalar dual-value mismatches.
Required regression coverage
Before closing this issue, add tracked project-owned tests that:
"0"through the same deep-comparison path used byTest::Differences.HTTP::BrowserDetector equivalent data-driven regression so the CPAN failure cannot silently return.Do not fix this by weakening
Test::Differencesglobally or by changing the upstream fixture. The implementation must preserve Perl-compatible scalar behavior at the value/operation boundary.