MooX::ConfigFromFile::Role::HashMergeLoaded(3pm)

MooX::ConfigFromFile::Role::HashMergeLoaded3pm

Allows better merge strategies for multiple config files

Usage

  package MyApp::Cmd::TPau;
  use DBI;
  use Moo;
  use MooX::Cmd with_configfromfile => 1;
  
  with "MooX::ConfigFromFile::Role::HashMergeLoaded";
  has csv => (is => "ro", required => 1);
  sub execute
  {
      my $self = shift;
      DBI->connect("DBI::csv:", undef, undef, $self->csv);
  }
  __END__
  $ cat etc/myapp.json
  {
    "csv": {
      "f_ext": ".csv/r",
      "csv_sep_char": ";",
      "csv_class": "Text::CSV_XS"
    }
  }
  $cat etc/myapp-tpau.json
  {
    "csv": {
      "f_dir": "data/tpau"
    }
  }

Overview

This is an additional role for MooX::ConfigFromFile to allow better merging of deep structures.

Attributes

config_merge_behavior

This attribute contains the behavior which will config_merger use to merge particular loaded configurations.

config_merger

This attribute contains the instance of Hash::Merge used to merge the raw_loaded_config into loaded_config.

loaded_config

This role modifies the builder for loaded_config by merging the items from raw_loaded_config in order of appearance. It is assumed that more relevant config files are in front and are filled up with defaults in following ones.

Acknowledgements

Releases

5 releases since Debian 9 (Stretch); the text changed 2 times.

  1. 9
  2. 10–11
  3. 12–13

Author

Jens Rehsack, "<rehsack at cpan.org>"

From libmoox-configfromfile-perl 0.009-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.