Fully qualified Kelp module name and config initialization

15 views
Skip to first unread message

mla

unread,
Nov 16, 2013, 5:42:55 PM11/16/13
to perl...@googlegroups.com
Hi!

I was experimenting with my first Kelp module today and hit a snag.
I named it MyApp::Kelp::Module::Foo since I didn't think it was a good idea to use the top-level Kelp::Module namespace for a non-public module.

So no problem, I added '+MyApp::Kelp::Module::Foo' to my config.pl modules list. Since Kelp uses Plack::Util::load_class, and that code treats a leading + as indicating it's fully qualified, the module loads fine.
However, I'm unable to pass any config values to it through the modules_init hash.

It looks like what's happening is the config merge process is treating the + as a merge directive and stripping it off. So the config ends up with modules_init.MyApp::Kelp::Module::Foo.
However, when it tries to look up the key to pass to build(), it's still using the value with the leading + from the modules directive and so is ignoring the values entirely.

Any suggestions?

Thanks.


mla

unread,
Nov 16, 2013, 6:21:46 PM11/16/13
to perl...@googlegroups.com
I've created a patch that seems to work (also added a test in  t/module_load.t).

I submitted a pull request.


Stefan Geneshky

unread,
Nov 16, 2013, 11:44:51 PM11/16/13
to perl...@googlegroups.com
Your patch seems like a good, elegant solution. I'll test it a little more to make sure it doesn't break backwards compatibility, and I'll merge the pull request.

Thanks,
Stefan
Reply all
Reply to author
Forward
0 new messages