Can you have the package read __DATA__ and fill a package variable, if the package variable isn't defined yet? Something like:
{ my %config; sub new { if (not %config) { %config = read_config_from(__DATA__); } # Now create the object... } }
I'm sure you could make this more flexible, reading from __DATA__ unless passed some other file or file handle.
-QM
--
Quantum Mechanics: The dreams stuff is made of
2019-04-11 Athanasius fixed opening code tags
In reply to Re: Good practice for OO module defaults
by QM
in thread Good practice for OO module defaults
by davies
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |