---
name: "MooX::ConfigFromFile::Role::HashMergeLoaded"
section: "3pm"
platform: "linux"
package: "libmoox-configfromfile-perl"
version: "0.009-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/MooX::ConfigFromFile::Role::HashMergeLoaded"
---

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

allows better merge strategies for multiple config files

## NAME

MooX::ConfigFromFile::Role::HashMergeLoaded - allows better merge strategies for multiple config files

## SYNOPSIS

```
  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"
    }
  }
```

## DESCRIPTION

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.

## AUTHOR

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

## ACKNOWLEDGEMENTS

## LICENSE AND COPYRIGHT

Copyright 2015-2018 Jens Rehsack.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See \<http://dev.perl.org/licenses/\> for more information.
