r3422 - in
/packages/libparams-classify-perl/branches/upstream/current:
.cvsignore Changes MANIFEST META.yml Makefile.PL README
lib/Params/Classify.pm t/ref.t
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Mon Aug 7 15:41:36 UTC 2006
Author: gregoa-guest
Date: Mon Aug 7 15:41:34 2006
New Revision: 3422
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3422
Log:
Load /tmp/tmp.qbmBU19646/libparams-classify-perl-0.001 into
packages/libparams-classify-perl/branches/upstream/current.
Added:
packages/libparams-classify-perl/branches/upstream/current/Changes
packages/libparams-classify-perl/branches/upstream/current/META.yml
Modified:
packages/libparams-classify-perl/branches/upstream/current/.cvsignore
packages/libparams-classify-perl/branches/upstream/current/MANIFEST
packages/libparams-classify-perl/branches/upstream/current/Makefile.PL
packages/libparams-classify-perl/branches/upstream/current/README
packages/libparams-classify-perl/branches/upstream/current/lib/Params/Classify.pm
packages/libparams-classify-perl/branches/upstream/current/t/ref.t
Modified: packages/libparams-classify-perl/branches/upstream/current/.cvsignore
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparams-classify-perl/branches/upstream/current/.cvsignore?rev=3422&op=diff
==============================================================================
--- packages/libparams-classify-perl/branches/upstream/current/.cvsignore (original)
+++ packages/libparams-classify-perl/branches/upstream/current/.cvsignore Mon Aug 7 15:41:34 2006
@@ -1,4 +1,4 @@
Makefile Makefile.old
blib pm_to_blib
META.yml
-IPC-Signal-Force-*
+Params-Classify-*
Added: packages/libparams-classify-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparams-classify-perl/branches/upstream/current/Changes?rev=3422&op=file
==============================================================================
--- packages/libparams-classify-perl/branches/upstream/current/Changes (added)
+++ packages/libparams-classify-perl/branches/upstream/current/Changes Mon Aug 7 15:41:34 2006
@@ -1,0 +1,21 @@
+version 0.001; 2006-08-03
+
+ * bugfix: in is_number(), check whether numeric conversion warns, rather
+ than using looks_like_number(), to avoid being confused by dualvars
+
+ * in t/ref.t, skip *foo{FORMAT} tests on older Perls that don't provide
+ that facility
+
+ * refer to Data::Float for classification of floating point values
+
+ * versioned dependencies in .pm
+
+ * declare module dependencies in Makefile.PL
+
+ * correct .cvsignore (had copy&modify detritus)
+
+ * include Changes file
+
+version 0.000; 2004-03-20
+
+ * initial released version
Modified: packages/libparams-classify-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparams-classify-perl/branches/upstream/current/MANIFEST?rev=3422&op=diff
==============================================================================
--- packages/libparams-classify-perl/branches/upstream/current/MANIFEST (original)
+++ packages/libparams-classify-perl/branches/upstream/current/MANIFEST Mon Aug 7 15:41:34 2006
@@ -1,4 +1,5 @@
.cvsignore
+Changes
MANIFEST
META.yml
Makefile.PL
Added: packages/libparams-classify-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparams-classify-perl/branches/upstream/current/META.yml?rev=3422&op=file
==============================================================================
--- packages/libparams-classify-perl/branches/upstream/current/META.yml (added)
+++ packages/libparams-classify-perl/branches/upstream/current/META.yml Mon Aug 7 15:41:34 2006
@@ -1,0 +1,11 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Params-Classify
+version: 0.001
+version_from: lib/Params/Classify.pm
+installdirs: site
+requires:
+ Scalar::Util: 1.01
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30
Modified: packages/libparams-classify-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparams-classify-perl/branches/upstream/current/Makefile.PL?rev=3422&op=diff
==============================================================================
--- packages/libparams-classify-perl/branches/upstream/current/Makefile.PL (original)
+++ packages/libparams-classify-perl/branches/upstream/current/Makefile.PL Mon Aug 7 15:41:34 2006
@@ -3,4 +3,7 @@
WriteMakefile(
NAME => "Params::Classify",
VERSION_FROM => "lib/Params/Classify.pm",
+ PREREQ_PM => {
+ "Scalar::Util" => "1.01",
+ },
);
Modified: packages/libparams-classify-perl/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparams-classify-perl/branches/upstream/current/README?rev=3422&op=diff
==============================================================================
--- packages/libparams-classify-perl/branches/upstream/current/README (original)
+++ packages/libparams-classify-perl/branches/upstream/current/README Mon Aug 7 15:41:34 2006
@@ -28,7 +28,7 @@
COPYRIGHT
-Copyright (C) 2004 Andrew Main (Zefram) <zefram at fysh.org>
+Copyright (C) 2004, 2006 Andrew Main (Zefram) <zefram at fysh.org>
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: packages/libparams-classify-perl/branches/upstream/current/lib/Params/Classify.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparams-classify-perl/branches/upstream/current/lib/Params/Classify.pm?rev=3422&op=diff
==============================================================================
--- packages/libparams-classify-perl/branches/upstream/current/lib/Params/Classify.pm (original)
+++ packages/libparams-classify-perl/branches/upstream/current/lib/Params/Classify.pm Mon Aug 7 15:41:34 2006
@@ -52,9 +52,9 @@
use strict;
use Exporter;
-use Scalar::Util qw(blessed looks_like_number reftype);
-
-our $VERSION = "0.000";
+use Scalar::Util 1.10 qw(blessed reftype);
+
+our $VERSION = "0.001";
our @ISA = qw(Exporter);
@@ -176,17 +176,6 @@
This returns true iff ARG is defined and an ordinary scalar (i.e.,
satisfies C<is_string> above) and is an acceptable number to Perl.
This is what one usually thinks of as a number.
-
-This differs from C<looks_like_number> (see
-L<Scalar::Util/looks_like_number>; also L<perlapi/looks_like_number>
-for a lower-level description) in excluding C<undef>, typeglobs,
-and references. Why C<looks_like_number> returns true for C<undef>
-or typeglobs is anybody's guess. References, if treated as numbers,
-evaluate to the address in memory that they reference; this is useful
-for comparing references for equality, but it is not otherwise useful
-to treat references as numbers. Blessed references may have overloaded
-numeric operators, but if so then they don't necessarily behave like
-ordinary numbers.
Note that simple (C<is_string>-satisfying) scalars may have independent
numeric and string values, despite the usual pretence that they have
@@ -201,15 +190,31 @@
is sufficient to collapse it to an ordinary number if you want the
numeric value in string form.
-=cut
-
-# Note: looks_like_number() returning true for undef and typeglobs appears
-# to be a bug in perl. It's present in v5.8.3 and reported as bug ID
-# #27606. Without this bug we wouldn't need the defined($arg) test below.
+A number may be either a native integer or a native floating point value.
+There are several subtypes of floating point value. For classification
+among floating point values see L<Data::Float>.
+
+This function differs from C<looks_like_number> (see
+L<Scalar::Util/looks_like_number>; also L<perlapi/looks_like_number>
+for a lower-level description) in excluding C<undef>, typeglobs,
+and references. Why C<looks_like_number> returns true for C<undef>
+or typeglobs is anybody's guess. References, if treated as numbers,
+evaluate to the address in memory that they reference; this is useful
+for comparing references for equality, but it is not otherwise useful
+to treat references as numbers. Blessed references may have overloaded
+numeric operators, but if so then they don't necessarily behave like
+ordinary numbers. C<looks_like_number> is also confused by dualvars:
+it looks at the string portion of the scalar.
+
+=cut
sub is_number($) {
my($arg) = @_;
- defined($arg) && reftype(\$arg) eq "SCALAR" && looks_like_number($arg);
+ return 0 unless defined($arg) && reftype(\$arg) eq "SCALAR";
+ my $warned;
+ local $SIG{__WARN__} = sub { $warned = 1; };
+ { no warnings "void"; 0 + $arg; }
+ return !$warned;
}
=back
@@ -388,6 +393,7 @@
=head1 SEE ALSO
+L<Data::Float>,
L<Params::Validate>,
L<Scalar::Util>
@@ -397,7 +403,7 @@
=head1 COPYRIGHT
-Copyright (C) 2004 Andrew Main (Zefram) <zefram at fysh.org>
+Copyright (C) 2004, 2006 Andrew Main (Zefram) <zefram at fysh.org>
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: packages/libparams-classify-perl/branches/upstream/current/t/ref.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparams-classify-perl/branches/upstream/current/t/ref.t?rev=3422&op=diff
==============================================================================
--- packages/libparams-classify-perl/branches/upstream/current/t/ref.t (original)
+++ packages/libparams-classify-perl/branches/upstream/current/t/ref.t Mon Aug 7 15:41:34 2006
@@ -29,4 +29,9 @@
test_ref_type([], "ARRAY");
test_ref_type({}, "HASH");
test_ref_type(\&is, "CODE");
-test_ref_type(*foo{FORMAT}, "FORMAT");
+
+SKIP: {
+ my $format = *foo{FORMAT};
+ skip "this Perl doesn't do *foo{FORMAT}", 9 unless defined $format;
+ test_ref_type($format, "FORMAT");
+}
More information about the Pkg-perl-cvs-commits
mailing list