TILs

Submitted by michael on Fri, 12/02/2011 - 03:43
  1. Each Perl module file needs to declare pragmas at the top of the file for them to have any effect. This is irritating. All this time I thought I was coding in modern perl, with strict and warnings enabled. Adding those things back has been a PITA. At least this time I was smart enough to build a test suite.
  2. Test::More doesn't handle UTF8 well at all. Because of how it duplicates the standard file handles, you can't easily change STDOUT etc to handle UTF8. It can be fixed by adding some boilerplate to the test files: [perl] use Test::More; my $builder = Test::More->builder; binmode $builder->output, ":utf8"; binmode $builder->failure_output, ":utf8"; binmode $builder->todo_output, ":utf8"; [/perl] And don't forget to add strict and warnings to each and every test file.