There are extant modules for handing IPv4 (and IPv6) addresses. I suggest you 
use one of those. Search /Net::IP/
Sent from my BlackBerry® smartphone with Nextel Direct Connect

-----Original Message-----
From: cr...@animalhead.com
Date: Sun, 11 Apr 2010 12:07:25 
To: <module-authors@perl.org>
Subject: Testing problem (32 bit numeric constants?)

My CPAN module takes an IP4 address as its operand, and checks
its operand as follows:
1) if the scalar is 4 bytes long, it's taken as a packed 32-bit  
binary value,
2) otherwise it is syntax checked as a "dotted quad", as in '1.2.3.4'.

An operand that fails these tests results in a return value of '**'.
An operand that passes but is not in the database returns '??'.
Other operands return country codes, like 'US'.

The tests for the module include these:
is ($ipw->getcc(0), '**', "getcc(0) should return **");
is ($ipw->getcc(999), '**', "getcc(999) should return **");
# string 1000 is equivalent to '49.48.48.48' which is not covered
is ($ipw->getcc(1000), '??', "getcc(1000) should return ??");
# string 9999 is equivalent to '57.57.57.57'
is ($ipw->getcc(9999), 'EU', "getcc(9999) should return EU");
is ($ipw->getcc(10000), '**', "getcc(10000) should return **");

These tests assume that Perl stores the constants 0, 999, 1000, 9999,  
and
10000 as strings. They pass on all CPAN testers' systems except one  
(so far).

On that system all of the above tests return '??'. The FAIL report is at
http://www.cpantesters.org/cpan/report/07094372-b19f-3f77-b713- 
d32bba55d77f

The only explanation that I can think of is that the numeric  
constants above
are stored in 32-bit form.

Is it possible to build or condition a perl system to do that?
If so, should such a system be used for CPAN testing?

This problem can probably be worked around by executing alternate tests
that use '0' ... '10000' if length(0)>1, but it would be nice if someone
could comment on this diagnosis first.

Thanks,
cmac


Reply via email to