Categories
Programming

Driving a Business with Perl

I’ve been a freelance programmer for over twenty years. One really important part of the job is getting paid for the work I do. Back in 1995 when I started out there wasn’t all of the accounting software available that you get now and (if I recall correctly) the little that was available was all pretty expensive stuff.

At some point I thought to myself “I don’t need to buy one of these expensive systems, I’ll write something myself”. So I sat down and sketched out a database schema and wrote a few Perl programs to insert data about the work I had done and generate invoices from that data.

I don’t remember much about the early versions. I do remember coming to the conclusion that the easiest way to generate PDFs of the invoices was using LaTex and then wasting a lot of time trying to bend LaTeX to my will. I got something that looked vaguely ok eventually, but it was always incredibly painful if I ever needed to edit it in any way. These days, I use wkhtmltopdf and my life is far easier. I understand HTML and CSS in a way that I will never understand LaTeX.

Why am I telling you this, twenty years after I started using this code? Well, during this last week, I finally decided it was time to put the code on Github. There were two reasons for this. Firstly, I thought that it might be useful for other people. And secondly, I’m ashamed to admit that this is the first time that the code has ever been put under any kind of version control (and, yes, this is an embarrassing case of “do as I say, not as I do“). I have no excuses. The software I used to drive my business was in a few files on a single hard drive. Files that I was hacking away at with gay abandon when I thought they needed changing. I am a terrible role model.

Other than all the obvious reasons, I’m sad that it wasn’t in version control as it would have been interesting to trace the evolution of the software over the last twenty years. For example, the database access started as raw DBI, spent a brief time using Class::DBI and at some point all got moved to DBIx::Class. It’s likely that I wasn’t using the Template Toolkit when I started – but I can’t remember what I was using in its place.

Anyway, the code is there now. I don’t give any guarantees for its quality, but it does the job for me. Let me know if you find any of it interesting or useful (or, even, laughable).

p.s. An interesting side effect of putting it under (public) version control – since I uploaded it to Github I have been constantly tweaking it. The potential embarrassment of having my code available for anyone to see means that I’ve made more improvements to it in the last week that I have in the previous five years. I’m even considering replacing all the command line programs with a Dancer app.

p.p.s. I actually use FreeAgent for all my accounting these days. It’s wonderful and I highly recommend it. But I still use my own system to generate invoices.

By Dave Cross

Dave Cross runs Magnum Solutions Ltd., a London Perl consultancy.

In 1998 he started London Perl Mongers, the first Perl Mongers group outside of Northern America.

He is the author of Data Munging with Perl and a co-author of Perl Template Toolkit.

3 replies on “Driving a Business with Perl”

I know just what you mean. I’ve been programming in Perl for about the same amount of time, and recently decided to put some of the tools I’ve created for my own use on GitLab, for others’ use and to promote myself as a freelancer. It was a little embarrassing to realize that none of them were really anything I’d want to represent me. Most were un- or badly documented. They might have debugging prints inserted here and there. If they were older, they contained code that worked, but wasn’t anything I wanted to use to demonstrate my current abilities. None were ready to act as a portfolio of the kind of work I do for pay.

So I’ve been going through them and adding POD documentation and bringing them up to snuff on current practices. Sometimes I think it takes longer than writing the original working code, because as you say, once you start on that knowing others will see it, it’s easy to keep trying to make it perfect.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.