in reply to Changing package variable via object-instance
I can't see anything blatantly wrong. But looking at your node, several questions come up:
- Why not make %config set inside _fill_config?
- If the only way to set %config is by calling _fill_config, why don't you set %config directly in there?
- Are you using AutoLoader/SelfLoader/load?
- If you are, and _change_config/_fill_config are in the area that's not always loaded, they will not see the "same" package lexical (it will be a package global to them).
- Why the flattening?
- You realize of course that if you're returning a hash, you're essentially flattening it to a list and return that. From an effieciency point of view, it's much better to return a reference to a hash (and probably have the package lexical $config be a reference as well).
- Are you sure _parse_file works ok?
- Double check in _fill_config that actually the thing you expect, is being returned.
I think there are other things going on in your example that I find strange. But for now I'll attribute those to the making of the (pseudo) takeout.
Hope this helps