Actually, this is a better version, since it takes care to not consider, say,
4.4 as a Int:
given quietly val prompt('int: ') || NaN {
when Int { say "you just entered the integer $_"; }
default { say "that was totally not an integer" }
}
On Tue Oct 25 10:15:56 2016, c...@zoffix.com
Thanks for the report,
First to clarify: Nil.Int is *not* an error as you state, it's a warning and
you can suppress it with `quietly` block. A numeric Nil is 0, which is what you
get in return.
As for the problem you're trying to solve, you can use the following code. If a
Nil is returned
# New Ticket Created by Jonas Kramer
# Please include the string: [perl #129956]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=129956 >
For most (all I've tested) types the method .Int works pretty much the
same and as I'd