in reply to Re: yaml dynamically load in perl
in thread yaml dynamically load in perl

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...

Replies are listed 'Best First'.
Re^3: yaml dynamically load in perl
by Your Mother (Archbishop) on Nov 02, 2015 at 13:14 UTC

    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.