Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

import Scalar-Util-Numeric 0.02 from CPAN

git-cpan-module:   Scalar-Util-Numeric
git-cpan-version:  0.02
git-cpan-authorid: CHOCOLATE
git-cpan-file:     authors/id/C/CH/CHOCOLATE/Scalar-Util-Numeric-0.02.tar.gz
  • Loading branch information...
commit 305fc6342753c1d42173dda10ac8415e6916a8fd 1 parent 4a2a1a9
authored October 09, 2005 schwern committed December 12, 2009
8  Changes
... ...
@@ -1,6 +1,10 @@
1 1
 Revision history for Perl extension Scalar::Util::Numeric.
2 2
 
  3
+0.02  Sun Oct 9 23:27:04 2005
  4
+    - fix uvmax test
  5
+    - fix documentation typo (thanks Mike Castle)
  6
+
3 7
 0.01  Sat Mar 26 15:01:09 2005
4  
-	- original version; created by h2xs 1.23 with options
5  
-		-n Scalar::Util::Numeric
  8
+    - original version; created by h2xs 1.23 with options
  9
+        -n Scalar::Util::Numeric
6 10
 
9  MANIFEST
... ...
@@ -1,9 +1,10 @@
1 1
 Changes
2  
-MANIFEST
  2
+lib/Scalar/Util/Numeric.pm
3 3
 Makefile.PL
  4
+MANIFEST
  5
+META.yml			Module meta-data (added by MakeMaker)
4 6
 Numeric.xs
5  
-README
6  
-lib/Scalar/Util/Numeric.pm
7 7
 ppport.h
  8
+README
  9
+t/pod.t
8 10
 t/Scalar-Util-Numeric.t
9  
-META.yml                                 Module meta-data (added by MakeMaker)
2  META.yml
... ...
@@ -1,7 +1,7 @@
1 1
 # http://module-build.sourceforge.net/META-spec.html
2 2
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
3 3
 name:         Scalar-Util-Numeric
4  
-version:      0.01
  4
+version:      0.02
5 5
 version_from: lib/Scalar/Util/Numeric.pm
6 6
 installdirs:  site
7 7
 requires:
11  Numeric.xs
@@ -11,11 +11,16 @@ is_num(sv)
11 11
     PROTOTYPE: $
12 12
     PREINIT:
13 13
     I32 num = 0;
14  
-    PPCODE:
  14
+    CODE:
15 15
 
16 16
     if (!(SvROK(sv) || (sv == (SV *)&PL_sv_undef))) {
17 17
 		num = looks_like_number(sv);
18 18
     }
19 19
 
20  
-    EXTEND(SP,1);
21  
-    PUSHs(sv_2mortal(newSViv(num)));
  20
+    XSRETURN_IV(num);
  21
+
  22
+void
  23
+uvmax()
  24
+    PROTOTYPE:
  25
+    CODE:
  26
+    XSRETURN_UV(UV_MAX);
2  README
... ...
@@ -1,4 +1,4 @@
1  
-Scalar-Util-Numeric version 0.01
  1
+Scalar-Util-Numeric version 0.02
2 2
 ================================
3 3
 
4 4
 This module exports a number of wrappers around perl's builtin looks_like_number function, which 
12  lib/Scalar/Util/Numeric.pm
@@ -17,7 +17,7 @@ our %EXPORT_TAGS = (
17 17
 
18 18
 our @EXPORT_OK = ( map { @$_ } values %EXPORT_TAGS );
19 19
 
20  
-our $VERSION = '0.01';
  20
+our $VERSION = '0.02';
21 21
 
22 22
 bootstrap Scalar::Util::Numeric $VERSION;
23 23
 
@@ -31,7 +31,7 @@ Scalar::Util::Numeric - numeric tests for Perl datatypes
31 31
 
32 32
 =head1 SYNOPSIS
33 33
 
34  
-    use Scalar:Util::Numeric qw(isnum isint isfloat);
  34
+    use Scalar::Util::Numeric qw(isnum isint isfloat);
35 35
 
36 36
     foo($bar / 2) if (isnum $bar);
37 37
 
@@ -64,12 +64,12 @@ Returns a nonzero value (indicating the numeric type) if $val is a number.
64 64
 
65 65
 The numeric type is a conjunction of the following flags:
66 66
 
67  
-    0x01  IS_NUMBER_IN_UV               (number within UV range - maybe not int)
68  
-    0x02  IS_NUMBER_GREATER_THAN_UV_MAX (the pointed-to UV is undefined)
  67
+    0x01  IS_NUMBER_IN_UV               (number within UV range - not necessarily an integer)
  68
+    0x02  IS_NUMBER_GREATER_THAN_UV_MAX (number is greater than UV_MAX)
69 69
     0x04  IS_NUMBER_NOT_INT             (saw . or E notation)
70 70
     0x08  IS_NUMBER_NEG                 (leading minus sign)
71  
-    0x10  IS_NUMBER_INFINITY            (this is big)
72  
-    0x20  IS_NUMBER_NAN                 (this is not)
  71
+    0x10  IS_NUMBER_INFINITY            (Infinity)
  72
+    0x20  IS_NUMBER_NAN                 (NaN - not a number)
73 73
 
74 74
 The following flavours of C<isnum> (corresponding to the flags above) are also available:
75 75
 
5,174  ppport.h
4486 additions, 688 deletions not shown
11  t/Scalar-Util-Numeric.t
@@ -4,15 +4,19 @@ use strict;
4 4
 use warnings;
5 5
 
6 6
 use Config;
7  
-use Test::More tests => 30;
  7
+use Test::More tests => 34;
8 8
 
9 9
 use_ok('Scalar::Util::Numeric', qw(:all));
10 10
 use_ok('Math::Complex');
  11
+use_ok('Math::BigInt');
11 12
 
12  
-my $uvmax = ~0;
  13
+my $uvmax = Scalar::Util::Numeric::uvmax();
  14
+my $uvmax_plus_one = Math::BigInt->new($uvmax)->badd(1)->bstr();
13 15
 my $inf = $Math::Complex::Inf = $Math::Complex::Inf; # silence warning
14 16
 
15 17
 is (isnum(0), 1, 'isnum(0) == 1');
  18
+is (isnum(1), 1, 'isnum(1) == 1');
  19
+is (isnum(-1), 9, 'isnum(-1) == 9');
16 20
 is (isnum('0.00'), 5, "isnum('0.00') == 5");
17 21
 is (isnum(undef), 0, "isnum(undef) == 0");
18 22
 is (isnum('A'), 0, "isnum('A') == 0");
@@ -21,9 +25,10 @@ is (isnum('0A'), 0, "isnum('0A') == 0");
21 25
 is (isnum(\&ok), 0, "isnum(\\&ok) == 0");
22 26
 is (isuv($uvmax), 1, 'isuv($uvmax) == 1');
23 27
 is (isuv(-1), 1, "isuv(-1) == 1");
24  
-is (isbig($uvmax + 1), 1, "isbig(\$uvmax + 1) == 1");
25 28
 is (isbig($uvmax), 0, "isbig(\$uvmax) == 0");
  29
+is (isbig($uvmax_plus_one), 1, "isbig(\$uvmax + 1) == 1");
26 30
 is (isfloat(3.1415927), 1, "isfloat(3.1415927) == 1");
  31
+is (isfloat(-3.1415927), 1, "isfloat(-3.1415927) == 1");
27 32
 is (isfloat(3), 0, "isfloat(3) == 0");
28 33
 is (isneg(-1), 1, "isneg(-1) == 1");
29 34
 is (isneg(-3.1415927), 1, "isneg(-3.1415927) == 1");
10  t/pod.t
... ...
@@ -0,0 +1,10 @@
  1
+eval "use Test::Pod";
  2
+
  3
+if ($@) {
  4
+	print "1..0 # Skip Test::Pod not installed", $/;
  5
+	exit;
  6
+} 
  7
+ 
  8
+my @PODS = qw#../blib#;
  9
+
  10
+all_pod_files_ok(all_pod_files(@PODS));

0 notes on commit 305fc63

Please sign in to comment.
Something went wrong with that request. Please try again.