mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-05 04:27:55 +00:00
5ef9d65a80
xCAT::RespawnUtils::policy() was called near the top of the file, some twenty lines above the "use xCAT::RespawnUtils" that loads the module. It works, because use is compile-time and perl compiles the whole file before running any of it, so the import has already happened by the time that statement executes. But nothing at the call site says so. It reads as a plain ordering mistake, and it stops working the moment someone converts the import to require -- a routine thing to do to a daemon that loads this many modules -- with the failure being an undefined subroutine at startup. Move the declaration below the imports, next to the osver() call that already makes a runtime call to a use'd module there. The only constraint on where it can go is that ssl_reaper closes over $mon_respawn and so must be compiled after it is declared; the new position clears that by a thousand lines, and compiling under strict is what proves it, since a lexical declared after the sub would fail to compile rather than silently bind elsewhere. Pure relocation: the moved block is byte-identical and no behaviour changes. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>