in reply to Best Practice for Lots of Static Data

I'd suggest going with some combination of the 2nd and 3rd ideas:

I would probably keep the data in separate files so it was easier to maintain. 15-20 files isn't that bad. I'd also favor a flat text format rather than a database or persisted data structure format (like Storable), since they would be human-readable and could be easily read (with minimal dependencies) by any other applications that needed the data.

Writing accessors for each file/device could certainly streamline the interface. You could even create a (single) class that loaded the correct data as objects are instantiated (like a simplified factory design, if my OO terminology is correct). If the data really is as simple as you describe, though, objects may be overkill. Simply returning an arrayref may be just as easy.

More experienced monks will likely suggest better ways to do this. :-)

  • Comment on Re: Best Practice for Lots of Static Data