• Fixing my #1 bash annoyance

    Ever open up a Terminal window and hit Tab and Bash sits for a few seconds until it finally comes back and asks Display all 2224 possibilities? (y or n) Because it went and compiled a list of EVERY executable you could possibly want to execute? Yeah, me, too, and I hate it. The fix is simple. Add this to your ~/.bashrc shopt -s no_empty_cmd_completion No more completion on nothing!
  • Artistic License 2.0 makes dual-license boilerplate unnecessary

    The dual-licensing in much module boilerplate these days is unnecessary. You can simplify your licensing by using only the [Artistic License 2.0](http://www.opensource.org/licenses/artistic-license-2.0.php). There are plenty of modules out there that license themselves "under the same terms as Perl itself", and [there are problems with that approach](http://perlbuzz.com/2008/04/the-problem-with-same-terms-as-perl-licensing.html). For the past year or so I've been using the approach of being explicit about "Artistic or GPL, your choice", but that's unnecessary, too. According to Allison Randal, one of the architects of Artistic License 2.0, "Artistic 2 allows for any GPL-like license, not just [GPL 2](http://www.opensource.org/licenses/gpl-2.0.php). Specifically, it allows for [GPL 3](http://opensource.org/licenses/gpl-3.0.html) or later, or a completely non-GPL copyleft license. So, the dual license is unnecessary." There's a page on the [Perl Foundation website](http://www.perlfoundation.org/) about [CPAN licensing guidelines](http://www.perlfoundation.org/cpan_licensing_guidelines) that explains more options in more detail. From here on out, my code is going to say: =head1 LICENSE Copyright (C) 2010, Andy Lester, This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
  • Allison Randal on how open source is more than code

    Allison Randal has some insights from her Twitter stream today about how open source is more than just a way to create and share code.

    Read on →

  • How to shuffle a list in Perl

    If you've got a list of things in Perl, and you want them in random order, don't try to make up a way to do it yourself. Use the shuffle function in the List::Util module. Say you want a list of files from a directory:
    use List::Util qw( shuffle );
    my @files = glob( '*' );
    @files = grep { -f } @files;
    @files = shuffle @files;
    Of course you can combine that into one expression:
    use List::Util qw( shuffle );
    my @files = shuffle grep { -f } glob( '*' );
    Or from the command line:
    perl -MList::Util=shuffle -le'print for shuffle grep {-f} glob("*")'
    Don't worry that List::Util is a module, because it's a core module that's been included with Perl since 5.7.3
    $ corelist List::Util
    List::Util was first released with perl 5.007003
    The shuffle function is extremely simple, and how here's a little [article that explains why it works](http://eli.thegreenplace.net/2010/05/28/the-intuition-behind-fisher-yates-shuffling/).
  • Handling multiple SSH keys in your SSH config

    I’ve been frustrated lately trying to juggle multiple SSH keys on various servers I’m on. If I’ve got one set up to the Subversion server at work, then I can’t authenticate with github. If I let github be the server that I have a private key for, then I’m entering a password whenever I do an svn up on the work server. I played with ssh-agent, but that seemed to require starting up a process every time I logged in, and I couldn’t get it running in my .bashrc, and it required manually adding keys. And then I stumbled across this article that introduced me to the IdentityFile argument. Now I have this in my ~/.ssh/config and all is well with the world.

    Read on →