in reply to yaml dynamically load in perl

For #1 you might look into Hash::MultiValue or, as you already mentioned, Hash::Merge. For the rest… it kind of sounds like a mess that would be better addressed by abstracting out each part/tool to Perl that can also be configured via #1.

As shmem said, yes, of course it's doable. Pretty complicated problem with a pretty terse description. Break it into pieces with real examples of what you have and what you want it to become.

Replies are listed 'Best First'.
Re^2: yaml dynamically load in perl
by louie_45 (Acolyte) on Nov 02, 2015 at 10:11 UTC
    Thanks for your comments. And how could I make the tag type work? I tried to define a class like: Foo::myPrint
    test: !!perl/Foo::myPrint - strings_to_print
    Then, I want to call the Print method in the Foo.pm like:
    $conf-{'test'}->myPrint("strings_to_print");
    It does not work...

      I'm suggesting that you build a data model module in Perl to be configured with your data; the module and its methods are not in config. just its data. This is one of the things I think Catalyst does very well. It's too complicated, for the time I have today, to write a working demo. This is the idea in a Catalyst idiom.

      # Load application. Application loads its data models. # Instantiate model(s) with conf. String::Thing: strings: - one - two, etc # Use models via application or bare if you prefer. # This $conf-{'test'}->myPrint("strings_to_print") beomes $app->model("StringThing")->strings;

      It might not be the right approach for your problem but might be good. You have a complicated problem that is a little under described.