fix: suppress uninitialized warning in pod2man when Makefile is absent#481
Draft
Koan-Bot wants to merge 1 commit intoPerl-Toolchain-Gang:masterfrom
Draft
fix: suppress uninitialized warning in pod2man when Makefile is absent#481Koan-Bot wants to merge 1 commit intoPerl-Toolchain-Gang:masterfrom
Koan-Bot wants to merge 1 commit intoPerl-Toolchain-Gang:masterfrom
Conversation
When pod2man checks whether a man page is up-to-date it compares the man page mtime against the hardcoded file "Makefile". If that file does not exist (e.g. when FIRST_MAKEFILE renames it, or during out-of-tree builds like ZoneMinder on Gentoo), stat() returns an empty list and mtime() returns undef, triggering: Use of uninitialized value in numeric gt (>) at .../Command/MM.pm line 147. Use "// 0" to treat a missing makefile as having mtime 0, which is the correct semantic: a non-existent baseline means the man page is trivially newer than it, so the skip logic still works correctly while the warning is eliminated. Fixes Perl-Toolchain-Gang#479
Grinnz
reviewed
Mar 19, 2026
| next if ((-e $man) && | ||
| (mtime($man) > mtime($pod)) && | ||
| (mtime($man) > mtime("Makefile"))); | ||
| (mtime($man) > (mtime("Makefile") // 0))); |
Contributor
There was a problem hiding this comment.
I don't think it's appropriate to make EUMM require 5.10 for a trivial line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ExtUtils::Command::MM::pod2mancompares the man page mtime against the hardcoded file"Makefile"to decide whether to skip regeneration. When that file does not exist (e.g.FIRST_MAKEFILErenames it, or during sandbox/out-of-tree builds like ZoneMinder on Gentoo),mtime()returnsundefand Perl emits many warnings:Using
// 0treats a missing makefile as having mtime 0 — the correct semantic (man page is trivially newer than a non-existent baseline), with no warning.Fixes #479
Changes
lib/ExtUtils/Command/MM.pm: changemtime("Makefile")to(mtime("Makefile") // 0)on the skip-check linet/pod2man.t: add regression test that verifies no uninitialized-value warnings are emitted whenMakefileis absentTest plan
t/pod2man.tcreates a temp directory without aMakefile, puts a pod source and an up-to-date man page there, callspod2man(), and asserts zero uninitialized-value warningsprove -l t/pod2man.t t/eu_command.tpasses cleanlyGenerated by Kōan /fix
Quality Report
Changes: 2 files changed, 46 insertions(+), 2 deletions(-)
Code scan: clean
Tests: skipped
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline