cpanm 1.1.2 is now shipped to CPAN with a small but great improvement: now it automatically cleans up the stale "work directories", so you don't need to worry about the ~/.cpanm/work/* taking up a lot of disk space after a heavy use of cpanm for 1 year etc.
The reason I tried to avoid implementing the cleanup was that I really dislike the default behavior of CPAN.pm, which is:
- It does the cleanup before your installation begins. This feels rude to me, like when you make a phone call to a customer support, they take the call but go on hold, saying "Hey I need to pee. Can you hold on for a minute?"
- The expiration is based on file sizes, which might have been nice when the disks are expensive. But disks are cheap now, and doing based on file size requires a lot of stat() calls.
So cpanm's cleanup behavior is solely based on the timestamps. By default it cleans up all the work directories older than 7 days. And the nice thing about this is that the work directories have its creation timestamp as its filename, so there won't be any stat() calls required for each work directories, even if you have many.
And yes, cleanup happens after your installation has finished. You won't really notice that it's happening.