Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: yaml dynamically load in perl

by Your Mother (Archbishop)
on Nov 01, 2015 at 19:44 UTC ( [id://1146632]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1146632]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found