February 2012 Archives

Why is this "use" a syntax error?

Many Perl developers are unaware that they can assert a module version with an import list at the same time. For example:

use Test::More 0.96 tests => 13;

However, the following is a syntax error:

use Test::More  .96 tests => 13;

Frankly, I don't know why. Here's a program which demonstrates my confusion. It exhibits more or less the same behavior on 5.8.9, 5.10.1, 5.12.4 and 5.14.2.

And the output is:

SV = NV(0x7fc84083a5e8) at 0x7fc84082be90
  REFCNT = 2
  FLAGS = (NOK,READONLY,pNOK)
  NV = 0.96
SV = NV(0x7fc84083a5e0) at 0x7fc840800fd0
  REFCNT = 2
  FLAGS = (NOK,READONLY,pNOK)
  NV = 0.96
Argument "2.121_17" isn't numeric in subroutine entry at (eval 2) line 2.

Error is: none
---------------------------
String found where operator expected at (eval 3) line 1, near ".01 'Dumper'"
        (Missing operator before  'Dumper'?)

Error is: syntax error at (eval 3) line 1, near ".01 'Dumper'"

The Devel::Peek shows that both numbers are the same, as far as Perl is concerned, but using .96 for the version is a syntax error. Reading perldoc use hasn't cleared this up for me. Is this a parsing bug or is there something else going on?

Unicode and Passwords

As I was doing some reading on Unicode, I had to sign up for a free account with ft.com site in order to read one of their articles. I normally use strong passwords, but this Web site presented me with the following error message:

Your password must be at least 6 characters long and include letters and numbers only

Ignoring the bad user interface — please tell me before I typed the damned password — it's also suggestive of security issues (ask Bobby for one reason why programmers have such bad password restrictions).

And that got me to thinking about Å, also known as U+212B.

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See http://www.allaroundtheworld.fr/ for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book! http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/