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 '??'.
Click here to see the FAIL report.
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 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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.