Recently in CPAN Category
Linux Journal has an article on creating Excel files using Spreadsheet::WriteExcel. It has its quirks, like creating corrupted spreadsheets if you try to populate a cell more than once, but when you need it, there's nothing else to do what it does.
Adam Kennedy posted an excellent article about huge performance hits he found with File::Find::Rule. From the docs, there's this sample to find all the *.pm files in @INC:
# Find all the .pm files in @INC my @files = File::Find::Rule->file ->name( '*.pm' ) ->in( @INC );What this search REALLY says is "Find every single file in all these trees, then do an slow IO stat call to the operating system on every single one to work out which ones are files, and only then do a quick regex match on the file names to keep the 5% that have the ending we want and throw away the 95% that don't".
Now I'm worried about if I'm doing the right order of checking in File::Next, a lightweight file finder that ack relies on.
Ricardo Signes' marvelous module CPAN::Mini just got an update today, and it reminds me to tell you all how great it is to be able to have a small version of the CPAN on your local hard drive, especially on a laptop. The included minicpan program makes it trivial to update your local archive.
First, I make a little ~/.minicpanrc that looks like this:
local: ~/minicpan/ remote: http://cpan.pair.com/pub/CPAN/ also_mirror: indices/ls-lR.gz
And then I run minicpan every so often. This pulls in the latest version of each distribution, and deletes ones that are obsoleted by newer versions. When I run minicpan, it looks like this:
$ minicpan authors/01mailrc.txt.gz ... updated modules/02packages.details.txt.gz ... updated modules/03modlist.data.gz ... updated mkdir /tmp/Woq_DHsWsN/indices indices/ls-lR.gz ... updated indices/ls-lR.gz ... updated mkdir /home/andy/minicpan/authors/id/G/GR/GROMMIER authors/id/G/GR/GROMMIER/Text-Editor-Easy-0.01.tar.gz ... updated authors/id/G/GR/GROMMIER/CHECKSUMS ... updated mkdir /home/andy/minicpan/authors/id/Z/ZO/ZOFFIX authors/id/Z/ZO/ZOFFIX/Acme-BabyEater-0.01.tar.gz ... updated authors/id/Z/ZO/ZOFFIX/CHECKSUMS ... updated ... cleaning /home/andy/minicpan/authors/id/L/LU/LUKEROSS/DBIx-StORM-0.04.tar.gz ...done cleaning /home/andy/minicpan/authors/id/L/LU/LUKEC/Test-WWW-Selenium-1.13.tar.gz ...done cleaning /home/andy/minicpan/authors/id/L/LU/LUKEC/mocked-0.07.tar.gz ...done cleaning /home/andy/minicpan/authors/id/L/LO/LOCATION/Geo-IP2Location-2.00.tar.gz ...done cleaning /home/andy/minicpan/authors/id/L/LO/LODIN/Regexp-Exhaustive-0.03.tar.gz ...done
Currently the repository is only 846M of disk space. Who doesn't have an extra gig lying around these days?
uniqua:~/minicpan $ du -sh 846M .
I also point my CPAN shell configuration to use the mini CPAN as its source of modules by prepending file:///home/andy/minicpan to the list of URLs it checks.
Thanks to Ricardo for putting out this great tool, and Randal Schwartz for the original column on which it was based.