Skip Menu |
 

This queue is for tickets about the Scalar-List-Utils CPAN distribution.

Report information
The Basics
Id: 89792
Status: new
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: victor [...] vsespb.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Enhancement - function to test that value is numified
Download (untitled) / with headers
text/plain 925b
Perl has inconsistence when work with Infinity: perl -e 'my $s = "inf"; $s++; print $s+0' 0 perl -e 'my $s = "inf"+0; $s++; print $s+0' inf more info http://www.perlmonks.org/?node_id=1025148 Consider the following example: ==== sub x { my (undef, $s) = split(' ', shift); $s+0; } my $p = x("abc inf"); $p++; print $p; ==== it will print "inf", but If I replace "$s+0" with "$s", it will print "ing". So, to write Unit test for this code, I need a function which will be able to test that x() returns something numified (i.e. with +0). I propose adding such function to Scala::Util. (another reason why people might want to test in unit tests, if the particalar value numified, is performance, huge array of numeric-only values takes less memory). Currently something like this can be implemented using B::class(B::svref_2object(\$_[0])) eq 'IV' but the problem is, that use of B module considered a hack.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.