I am writing a module using Moo. I want the object to have some defaults if values are not specified at creation. Some of the strings are quite long and it is conceivable that they may change. A config file is possible, but that would mean enforcing a directory structure on every machine, Windows or *u*x, which does not appeal to me. I therefore planned to use __DATA__ to hold the strings. There are plenty of warnings on this site not to use __DATA__ in production. Also, it causes problems. If I create two objects, the second comes without the defaults because __DATA__ has already been read. The options as I see them are:
I am minded to use the fourth of these, but would like to know the Monasteriat's recommendations.
Regards,
John Davies
In reply to Good practice for OO module defaults by davies
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |