The 2015 CPAN Pull Request Challenge!

I saw on my Perl Weekly newsletter today that there’s a new challenge started by Neil Bowers to try to help people working more on the various CPAN modules which need work. This seems like a neat idea, and the gist of the challenge is simple:

  • Every month you are assigned a new module to make a pull request for
    • You get a branch
    • You won’t get any of your own modules
    • You won’t get the same author twice
    • You can request a namespace to work in
    • You get the Github repo in which the module lives
  • Every month you promise to make at least one pull request to that module, whether it be:
    • Bug fixes
    • Documentation
    • Tests
    • New features
  • If you don’t like the module you got, you may request different one

Neil is also encouraging folks to blog about this while they’re doing it, and so I am. I’ll keep you all up-to-date as to what I’m working on for this challenge.

For more information, you should probably refer Neil Bowers’ post about the 2015 CPAN Pull Request Challenge.

Currently, I’m still also doing work on Net::AMQP::RabbitMQ, mostly focusing on some interesting things I found in the C library it is binding to.

I’m excited to receive my first assignment, however, which I believe should be arriving at some point today (2015-01-05).

Net::AMQP::RabbitMQ Releases

This weekend I released two versions of Net::AMQP::RabbitMQ on CPAN: 0.007000 and 0.007001.

The first version was the culmination of some major refactoring in how Perl types were inferred into C and AMQP types in headers, and then also adding a bunch of previously-unsupported AMQP header types into Perl.

The second version was fixing an oversight where timestamp types in headers weren’t supported. I also added a manual_tests directory which is where I will add some manual tests as I do some of those. There is a test where I verify dead-letter queue functionality that helped me verify that x-death headers were working properly now.

The primary reason why this is huge is because the special x-death headers are now supported. Not only that, but in the event that you had a non-Perl program publishing to your queue with headers, you may have had compatibility issues with the header types that would cause to have to kluge.

As of now, the new version – 0.007001 – isn’t live, but if you search for the module on CPAN you should find the latest published version.

If you notice any issues, let me know by going to the official github repo and filing an issue.

Re-factoring ModExec Day 2

Today I got tests done, and I kinda abandoned for exception handling. I switched over to using Try::Tiny since it looks like there are known issues with in more modern frameworks like Moose. I’m going to try to avoid using ##no critic as much as I can, but I had to use it twice in my ModExec::Exception class since I wanted to include the sugar functions from Try::Tiny, and since I want to use die() in my throws to keep the object intact.
Here’s tonight’s changeset:
Next up is the base class, ModExec, itself.

Exceptions in Perl, Then and Now

In re-factoring ModExec, I have started with the exceptions. I’m debating how I used to do them. When I first started I used Error qw/:try/ and Error::Simple for exceptions. I still think I will, it looks like it’s still being well-maintained by Shlomi Fish (see here).
I think that the piece I will bite off first is to get some test coverage around my exceptions and add documentation. They’re not much more than what you get with Error::Simple, but there’s some stuff in there for stack dumps and things like that.
Goals for this first pass are:

  1. Pass a `perlcritic -3` for all exception code
  2. Add POD for all exception code
  3. Add a test for at least some of the methods (more tests will be added later)

Before and After

Here are some GitHub links:

Re-factoring Your Old Projects

Once upon a time I maintained a very small, lightweight framework to allow for Perl interfaces to be integrated with directly from client-side JavaScript. I called this framework ModExec. This framework took into account the various security implications which I’m sure are already sounding the klaxons in your brain. I even managed to get this framework into a state where I was proud enough to present it to the Perl Special Interest Group in Lisle, IL in 2006. Man, those were the days… and that was 7 years ago. Continue reading “Re-factoring Your Old Projects”

Gist of the Day: Playing with Forks

Parallel processing is all the rage these days, and life has me at a point where I’m needing to use it. I am having to minimize dependencies in the task at hand, so I’m having to forego my usual CPAN modules and use basic system calls. It’s not terribly complicated, but just to refresh myself on the basics I went ahead and whipped up a quick demo that I thought others might find useful. This is a very simple demonstration of how to use fork() and wait(). Continue reading “Gist of the Day: Playing with Forks”

Gist of the Day: Test::MockModule for Repeatable Tests!

I like repeatable tests. The #1 benefit of repeatable tests is that they’re repeatable. This also means they’re less vulnerable to data changes (e.g. this test depends on this product record remaining unchanged) and don’t pollute your environment. There are two ways that I think you can make your tests repeatable, and I think both of them are equally valid, and each should be used in their appropriate time:

  1. Creating and tearing down fixtures
  2. Using some sort of mocking framework to force a repeatable result from an up-stream dependency that is not what you’re trying to test

Continue reading “Gist of the Day: Test::MockModule for Repeatable Tests!”

Not Gone, Just Moving

Hey all, I just wanted to let you know that I didn’t die… I am only going through a job change and a move, so I am currently bogged down with a number of things.
I expect to be back up and running again by next weekend at the latest. I suspect very few people care, but in the event that you do, now you know.
I’ll share all of the details when I have them 🙂

Gist of the Day: How to Test a File You Wrote!

First, I suppose I should apologize for two days of silence. I am currently going through a major life transition, so things could get a little spotty for a while. I haven’t forgotten about you. I actually have had a couple of days where my experiment for the Gist of the Day failed, and I couldn’t get something working in time to put it up.
Today, however, I do have something for you!
Today we are going to cover two topics very briefly (as usual): 1) how do you factor files you wrote into your tests, and 2) how do you write your code with testing in mind (which you should). Continue reading “Gist of the Day: How to Test a File You Wrote!”