Changes for version 0.44 - 2026-12-01

  • Behaviour Changes
    • When XML::Simple is absent and XML::PP cannot parse a config_file that looks like XML, the remaining parsers (YAML, TOML, INI, Config::Auto, Config::General) are now tried instead of the file being dropped.
  • Security
    • The XML external entity guard now also protects the XML::PP paths. It used to exist only where XML::Simple was used, so a file declaring an <!ENTITY ... SYSTEM|PUBLIC> was refused with XML::Simple installed but parsed without a warning when only XML::PP was available (and a refused base.xml was then handed to XML::PP anyway). Entity declarations are now refused, with a warning, before any parser is chosen.
    • Optional modules are loaded with a path require rather than a string eval, so a driver name can never be evaluated as code.
    • The STDERR duplication around Config::Abstract is a three-argument open that croaks when the duplicate cannot be made, instead of carrying on with STDERR closed.
  • Bug Fixes
    • With XML::Simple absent, an Apache-style config_file such as "<server>...</server>" followed by plain "key value" lines was read by XML::PP, which silently dropped everything after the first element. It is now offered to Config::General first whenever the text (without an XML declaration) is not exactly one XML element, as the XML::Simple path already did.
    • A malformed config_file (for example broken XML) no longer makes new() die with "Can't use string as a HASH ref" when other configuration is present and no logger is set; the file is skipped with a warning.
    • A parser result that is not a hash is no longer passed to merge().
    • TOML tier files that make TOML::Tiny die are now skipped with a warning.
    • Fixed the LIMITATIONS entry that named Crypt::Storable::dclone instead of Storable::dclone.
  • Enhancements
    • New data_handle option: configuration text read from an open filehandle, normally \*DATA, so a program can carry its own defaults after __DATA__. The format is detected as for config_file; it is merged above data and below every file, and works with lazy and reload(). This resolves the long-standing TODO.
    • _load_config shrank from about 600 to 200 lines: the per-format and config_file parsers are now small private methods (_parse_tier_file, _parse_unknown_file and the _try_* stages), the XXE pattern is one constant, and parse failures are reported by one routine. New t/data_handle.t covers the option and these cases.
    • New required option: when no configuration is found, new() croaks with the file names and directories it searched instead of returning undef, so a mistyped config_dirs entry or a file in the wrong place is diagnosed where the object is created. The default is unchanged: without required new() still returns undef. With lazy => 1 the croak is deferred to the first accessor call, in the same way as schema validation.
    • New share_dir() and share_file() methods: resolve a data file kept beside the configuration (templates, SQL, certificates) relative to the last configuration file loaded. share_dir() returns undef, and share_file() croaks, when the configuration came only from data, environment variables or the command line, since neither has a directory to resolve against.
    • New reload() method: rebuild the configuration from its sources on the same object, for long-running processes. Schema, validators, checker and the required check run again, and if loading or validation fails the previous configuration is kept and the error rethrown. Source records, the file list, the share directory and the searched-file lists are reset on every load, so explain_sources() no longer accumulates duplicate entries when a configuration is rebuilt.
    • New found() method: an arrayref of the files read by the last load, which also works in flatten mode where config_path itself is flattened.
    • New tests in t/unit.t cover required, share_dir(), share_file(), reload() and found().

Documentation

Display merged configuration from Config::Abstraction

Modules

Merge and manage configuration data from different sources