June 2014 Archives

Skipping large files when mirroring your mini CPAN

My Internet connection at home is not great: it's rather slow and flaky. When I ran minicpan to update my mini CPAN earlier today, the process always seemed to choke on this file: id/D/DG/DGINEV/Lingua-EN-SENNA-0.03.tar.gz: exit with Connection time-out error. The first run I thought it must be my connection and simply re-ran the script. After the second and third and being stuck in the same file, I got curious. Lo and behold, the file is 185MB big!

I then typed this to peek into my CPAN mirror:

% cd /cpan
% find -type f -size +10M

Turns out, there are qui…

One final rant about programmable completion in bash

Still hacking around bash tab completion. Released some utilities like pmpath, podpath, pmless, pmedit (you can find them in App-PMUtils distribution). To use these utilities:

% cpanm App::PMUtils
% complete -C pmpath pmpath ; # this line can be added to your .bashrc
% pmpath [TAB]
% pmpath tex[TAB]
% pmpath text/ansi[TAB]
% complete -C pmless pmless; # do the same for the other utils
(and so on)

You'll notice that I use slash instead of double colon as it should be. And here goes the rant.…

Another (silly) idea: autocorrect in shell (bash) tab completion

Here's another idea that just popped up in my head and can be considered silly, somewhat: autocorrect for tab completion.

bash already has cdspell shell option (enabled via shopt -s cdspell) which can correct directory names for you, so for example if you have a directory named "pictures" and you type "cd picture" or "cd pcitures" it will assume you meant "pictures" and cd to the corrected directory. To be honest I've never used this feature.

bash also has another option called dirspell which can correct spelling in directory name during completion. Try …

Silliness of the day: digit-by-digit tab completion for ints/floats

I was hacking on Perinci::Sub::Complete these past two days and I thought I'd add a (silly) feature that most other completion libraries don't (bother to) have.

# high-low
use strict;
use Perinci::CmdLine;

our %SPEC;

$SPEC{high_low} = {
v => 1.1,
args => {
first => {
schema => [int => req=>1, min=>1, max=>6],
req => 1,
pos => 0,
second => {
schema =>…

Cleaning up your DarkPAN

In a previous entry I blogged about creating your own DarkPAN. This is convenient when you're offline as you can still use 'cpanm' to install your modules and dependencies.

Now of course, if you're a diligent CPAN author (or a lazy worker finding ways to goof off and do busy work by writing and releasing CPAN modules), your DarkPAN will add up and need cleaning from time to time.

To delete older releases, I use ="https://github.com/sharyanto/scripts/b…

About Steven Haryanto

user-pic A programmer (mostly Perl 5 nowadays). My CPAN ID: SHARYANTO. I'm sedusedan on perlmonks. My twitter is stevenharyanto (but I don't tweet much). Follow me on github: sharyanto.