I contributed to CPAN!

I spend a lot of time dealing with Perl at $WORK (as you can tell by the word “$WORK”). One of my projects is updating our legacy code, which mostly runs on Perl 5.8. When I tried running things under Perl 5.20, some unit tests broke because as of Perl 5.18, the return order of keys and values from hashes are randomized. The code was generating links, such as

Thanks to the randomization, the order of “foo” and “bar” is unknown. Which is good! But rather than rewriting all the unit tests, I decided to write a Test::Deep helper to handle unordered parameters for me. Thus Test::Deep::URI! Now that test can be written like

And just because, I added support for partial URI matching, so it’d also match uri(“/?foo=1&bar=2”) or uri(“//yarr.com/?bar=2&foo=1”).

It’s nothing major, but it feels good to give something back. Plus now I can use it at work, and that problem is solved. 😀

About nfg

100% not a communist
This entry was posted in Code, General, Work. Bookmark the permalink.