Hacking Symbol::Approx::Sub

In October, for (I think) the second year, Digital Ocean ran Hacktoberfest — a campaign encouraging people to submit pull requests to Github repos in exchange for free t-shirts.

A few of us thought that this might be a good way to do a small bit of easy Perl advocacy, so we tagged some issues on Perl repos with “hacktoberfest” and waited to see what would happen.

I created a few issues on some of my repos. But the one I concentrated on most was symbol-approx-sub. This is a very silly CPAN module that allows you to make errors in the names of your subroutines. I wrote it many years ago and there’s an article I wrote for The Perl Journal explaining why (and how) I did it.

Long-time readers might remember that in 2014 I wrote an article for the Perl Advent Calendar about Perl::Metrics::Simple. I used Symbol::Approx::Sub as the example module in the article and it showed me that the module had some depressingly high complexity scores and I planned to get round to doing something about that. Of course, real life got in the way and Symbol::Approx::Sub isn’t exactly high on my list of things to do, so nothing happened. Until this October.

Over the month, a lot of changes were made to the module. I probably did about half of it and the rest was pull requests from other people. The fixes include:

  • Better tests (and better test coverage — it’s now at 100%)
  • Using Module::Load to load module
  • Using real exceptions to report errors
  • Updating the code to remove unnecessary ampersands on subroutine calls
  • Fixed a couple of long-term bugs (that were found by the improved tests)
  • Breaking monolithic subroutines down

And I’m pretty happy with how it all went. The work was mostly completed in October and this morning I finally got round to doing the last couple of admin-y bits and version 3.0.0 of Symbol::Approx::Sub is now on the way to CPAN. You still shouldn’t use it in production code though!

Thanks to everyone who submitted a pull request. I hope you did enough to earn a free t-shirt.

If you want to get involved in fixing or improving other people’s code, there’s the 24 Pull Request Challenge taking place over Advent. Or for more Perl-specific code, there’s the CPAN Pull Request Challenge.

p.s. In the Advert Calendar article, I linked to the HTML version of the results. For comparison, I’ve also put the new results online. It’s a pretty good improvement.


Originally published at Perl Hacks.


To view or add a comment, sign in

More articles by Dave Cross

  • The Perl Conference In Glasgow

    Yesterday (despite the best efforts of Virgin Trains to stop me) I came home from The Perl Conference in Glasgow. I had…

  • Introducing People to Perl

    For most of last week I was out of London running three days of Perl training for… well, I probably shouldn’t name…

    8 Comments
  • Professional Programmer is Professional

    (The image above was the first result I got when searching Google Images for a CC-licensed image for “professional…

  • Web Site Tune-Up: A Case Study

    I thought it might be interesting to talk about some of the topics I’ll be covering at my workshops at The Perl…

  • Monzo & IFTTT

    When I signed up for my Monzo bank account last year, one of the things that really excited me was the API they made…

  • Training in Glasgow

    It’s June, which means it’s only a couple of months until the Europe Perl community descends en masse on Glasgow for…

  • Selenium and Perl

    Some of you might remember the lightning talk I gave at the London Perl Workshop last year (it’s available on YouTube…

  • Brighton SEO – April 2018

    Last week I was at my second Brighton SEO conference. I enjoyed it every bit as much as the last one and I’m already…

    1 Comment
  • Two Weekend Projects

    It’s far too long since I’ve posted anything here. I’ve no excuse really.

    2 Comments
  • Intended Audience

    I thought I’d pretty much finished blogging about my upcoming Modern Web Development with Perl and Dancer training…

Explore content categories