Prior to v5.20,
perl used whatever random number generator the system provided. This meant that the same program could have statistically different results based on the quality of that function. The
rand() for Windows had a max of 32,768 (15 bits), while POSIX has
drand48 (48 bits). This sort of numerical un-portability has always been a problem with
perl since it’s relied on the underlying libc for so much. » Read more…
Prior to v5.20,
Perl 5.20 is out and there are some nice syntax changes that make life easier for Perlers, along with some improvements that don’t require any work from you. Some of the features are experimental, so be careful that you don’t create problems by overusing them until they settle down.
Perl v5.14 gets a step closer to a saner way to declare classes with its new
package NAME BLOCK syntax that lets you easily group everything that goes in a package. » Read more…
Perl 5.18 provides a new way to introduce experimental features in a program, augmenting the feature pragma that v5.10 added. This change marks certain broken v5.10 features as experimental with an eye toward possible removal from the language.
Smart matching in v5.10 led to several broken and conflated features. The
given used a lexical version of
$_, which broke many other common uses of that variable inside the
given, which I explain in Use for() instead of given() and you can see in given/when and lexical $_ …. » Read more…
Perl v5.18 is out and there are some major changes that you should know about before you upgrade. Most notably, some features from v5.10 are now marked experimental. If you use those features, you get warnings.
Up to v5.18, the vertical tab wasn’t part of the
\s character class shortcut for ASCII whitespace. No one really knows why. It was curious trivia that I pointed out in Know your character classes under different semantics. Whitespace in ASCII, POSIX, and Unicode represented different sets. Perl whitespace was different from POSIX whitespace by only the exclusion of the vertical tab. Now that little oversight is fixed. » Read more…
Perl v5.12 modifies the
package statement to take a version as well as a name. This allows you to implicitly declare the
$VERSION variable: » Read more…
I’ll be at OSCON on Tuesday, July 17, but you don’t have to find me to get up to 37% off Effective Perl Programming. That’s a slightly lower price than Amazon. To get that discount, you have to buy the book at Pearson’s booth in the exhibition hall. You’ll need to track me down on Tuesday afternoon or evening if you want me to sign your book.
If you can’t make it to OSCON, you can still get 35% off the cover price by ordering directly from the InformIT discount link or using the OSCON2012 discount code when you check out. Instead of navigating their site, you can go directly to our book.
If you’re not sure you want the book, you can look at a free sample chapter, which is also 35% off during OSCON.
Pod::Simple 3.21 changed its behavior when it encountered a non-ASCII character in Pod without an encoding. Instead of handling it quietly, it now gives a warning. That’s not so bad, but Test::Pod uses Pod::Simple, and whenever it sees a warning,
pod_ok fails, as it did in my Mac::Errors module:
# Failed test 'POD test for blib/lib/Mac/Errors.pm' # at .../Test/Pod.pm line 182. # blib/lib/Mac/Errors.pm (2776): Non-ASCII character seen before =encoding in 'donÃt'. Assuming ISO8859-1 # Looks like you failed 1 test of 2. t/pod.t ........... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/2 subtests
Unfortunately, the Pod tests are the sort that shouldn’t stop an installation, which is why many developers have a separate area for author tests (which I’ll cover in an upcoming Item). Outside of that, you have to fix the Pod.
There are two things here. First, I have a genuine error here. The module is auto generated from other source files and the “donÃt” is a mistake; it should be “donâ€™t” (with a smart quote) or even better, “don’t”. Test::Pod didn’t catch this before. So, that’s not bad.
More importantly, telling Perl that the source code is UTF-8 isn’t enough. When you use the utf8 pragma, the
perl interpreter reads the source as UTF-8:
However, a Pod parser ignores all the code. It looks for Pod sections and never sees that pragma, nor does it care. You have to tell the pod which encoding you have if you want to use something outside of ASCII:
I hadn’t used that in Mac::Errors, or any of my other modules, although in some of them I had used genuine UTF-8 sequences. Now any person using Test::Pod with the latest Pod::Simple won’t be able to install those modules normally. That is, until I fix them.
I could use other encodings, such as ISO-8859-1, as long as I declare the right thing and save the file correctly.