Tag Archives: Perl

Easy access to the HTML Devel::Cover report from Dist::Zilla::App::Command::cover

I love me some Dist::Zilla and Dist::Zilla::App::Command::cover. I wanted an easy way to load the Devel::Cover HTML coverage report. I’ve been using this on my Macbook.

dzil cover | grep ‘coverage.html’ | awk {‘print $5′}  | xargs open

and this on Ubuntu.

dzil cover | grep ‘coverage.html’ | awk {‘print $5′}  | xargs -I{} firefox {} &

pythonbrew, perlbrew minus Perl plus Python

Recently I wrote about App-perlbrew and wondered if something similar existed for Python. A friend of my showed me pythonbrew. Pythonbrew seems to be directly inspired by perlbrew, it has a very similar command structure and syntax.

Both pythonbrew and perlbrew have a predefined list of supported versions of Python and Perl respectively. It is my personal opinion that this isn’t a good thing. Both Python and Perl list their released versions on their sites and it would be trivial to parse that information. I have a patch for perlbrew that does just that. I have started working on one for pythonbrew today and hope to have it finished and tested in a few days. I should probably send a pull request for the perlbrew patch as it doesn’t do anyone much good sitting in my repository.

Converting Poker Stars Play Money Logs to Real Money

I wanted to use Poker Tracker to keep track of my stats when playing at the play money tables of Poker Stars. Poker Tracker doesn’t support the play money tables.

I wrote some Perl to convert the the lots from the play money format into the real money format.

use strict;
use Cwd;
use File::Find;
my $some_dir = "Z:\\HandHistory";
my $startDir = &Cwd::cwd();
find(\&processFile, $some_dir);
sub processFile {
    return if not /\.txt$/;
    my $inFileName = $_;
    my $infile = "$startDir/$File::Find::name";
    my $outfile = "$startDir/outHands/$inFileName.$$.converted.txt";
    open (inFILE, "<$infile") or die "can't open in file!: #$infile# ($!)";
    open (outFILE, ">$outfile") or die "can't open out file!:#$outfile# ($!)";
    my @players;
    while(<inFILE>) {
        @players = () if (s/^(PokerStars Game .*\()(\d+)\/(\d*)(\).*)$/\1\$\2.00\/\$\3.00\4/);
        push(@players, $1) if (/^Seat [\d+]: (.*) \(\d+ in chips\)/);
        foreach my $key (@players) {
            my $value = $key;
            $value =~ s/\s+/_/;
            ($value = $1) =~ s/($1)/_\1/ if ($key =~ /^(\d+)$/);
        s/([\( ])(\d+)([\) \.])/\1\$\2.00\3/g;
        s/\(Play Money\) //g;
        print outFILE "$_\n";