Underappreciated Perl Modules, UAVs, and Musings on Programming

In an effort to follow JT's advice about writing something new every day, I've queued up some articles over on my blog. Most of them will be about Perl programming, but also some UAV and Arduino stuff.

The first one today is about File::ShareDir, which I think is an underappreciated module that solves a problem we'll all probably hit sooner or later.


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

There's http://metacpan.org/module/Data::Section, which gives you more than one, but a sharedir is usually better (unless the content is teeny-tiny, or used from only one bit of code).


Data::Section is a marvellous module, and I also use File::ShareDir.

My general policy is: If these is any reason for the end-user (or admin) to edit the data, I use File::ShareDir. If the data is never-to-be-edited, Data::Section will do.

Of course the quantity of data matters. In GraphViz2 I put 4,200 bytes of data in the module, and use Data::Section.

But for much more than that, even if never edited, I'd use File::ShareDir.

Another possibility is File::HomeDir. I use that for Local::* modules (personal use only), but the problem with it in shipped modules is that some CPAN testers run tests under an account which has no home dir!

say $swears_profusely x 1000;

Leave a comment

About Timm Murray

user-pic I blog about Perl.