FW: Timm Murray’s Underappreciated Perl Modules Series: File::ShareDir

Problem: you have some wumpus-cavekind of data that needs to be distributed with your Perl module. Where do you put it in a cross-platform way?

Solution #1: Put it in a giant datastructure inside some module. This ends up with a big .pm file that chews up memory.

Solution #2: Put it in a __DATA__ section. But you only get one of those per module, and binary data might get hairy.

Best solution: File::ShareDir.

Read more on Timm Murray’s blog

Share Button