Subject: | Int type check can pass non-integer values |
v0.009 does not display this behaviour but 0.010 and greater all do with all Perl versions I have tested so far. Problem does not exist with PP Type::Tiny.
We have a GH ticket tracking this issue as it hit us in the Interchange6 project:
https://github.com/interchange/Interchange6/issues/28
I must apologise that I haven't been able to repeat the following problem as a standalone test case.
Here's the ugly workaround I've implemented which stringifies the value before testing it:
https://github.com/interchange/Interchange6/blob/master/lib/Interchange6/Cart/Product.pm#L152-L166
Unit testing of our Cart::Product class does *not* have this problem as per this test:
https://github.com/interchange/Interchange6/blob/master/t/unit/cart_product.t#L151
but when quantity is set via the writer method from a method in our Cart class here:
https://github.com/interchange/Interchange6/blob/master/lib/Interchange6/Cart.pm#L487
then corresponding failing test (assuming Cart::Product quantity attribute isa is reset to simple 'PositiveInt'):
https://github.com/interchange/Interchange6/blob/master/t/unit/cart.t#L349-L355
I'm willing to help debug as much as I am able though right now I don't have a clue where to start.
R.
PeteM