r6448 - in /trunk/libparams-classify-perl: Changes MANIFEST META.yml Makefile.PL README debian/changelog debian/control debian/rules lib/Params/Classify.pm t/purity.t

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Fri Aug 10 13:59:52 UTC 2007


Author: gregoa-guest
Date: Fri Aug 10 13:59:51 2007
New Revision: 6448

URL: http://svn.debian.org/wsvn/?sc=1&rev=6448
Log:
* New upstream release.
* Add libscalar-number-perl to (build) dependencies.
* Don't ignore errors from ($MAKE) distclean.
* Separate Build-Depends and Build-Depends-Indep.
* Include upstream changelog.

Added:
    trunk/libparams-classify-perl/t/purity.t
      - copied unchanged from r6447, branches/upstream/libparams-classify-perl/current/t/purity.t
Modified:
    trunk/libparams-classify-perl/Changes
    trunk/libparams-classify-perl/MANIFEST
    trunk/libparams-classify-perl/META.yml
    trunk/libparams-classify-perl/Makefile.PL
    trunk/libparams-classify-perl/README
    trunk/libparams-classify-perl/debian/changelog
    trunk/libparams-classify-perl/debian/control
    trunk/libparams-classify-perl/debian/rules
    trunk/libparams-classify-perl/lib/Params/Classify.pm

Modified: trunk/libparams-classify-perl/Changes
URL: http://svn.debian.org/wsvn/trunk/libparams-classify-perl/Changes?rev=6448&op=diff
==============================================================================
--- trunk/libparams-classify-perl/Changes (original)
+++ trunk/libparams-classify-perl/Changes Fri Aug 10 13:59:51 2007
@@ -1,3 +1,14 @@
+version 0.002; 2007-01-25
+
+  * add is_pure_string() and is_pure_number() functions that determine
+    how complicated a string scalar is
+
+  * in documentation for is_number(), reference Scalar::Number and
+    Data::Integer
+
+  * correct version requirement of Scalar::Util in module, making it
+    consistent with the dependency listed in Makefile.PL
+
 version 0.001; 2006-08-03
 
   * bugfix: in is_number(), check whether numeric conversion warns, rather

Modified: trunk/libparams-classify-perl/MANIFEST
URL: http://svn.debian.org/wsvn/trunk/libparams-classify-perl/MANIFEST?rev=6448&op=diff
==============================================================================
--- trunk/libparams-classify-perl/MANIFEST (original)
+++ trunk/libparams-classify-perl/MANIFEST Fri Aug 10 13:59:51 2007
@@ -7,4 +7,5 @@
 lib/Params/Classify.pm
 t/blessed.t
 t/classify.t
+t/purity.t
 t/ref.t

Modified: trunk/libparams-classify-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libparams-classify-perl/META.yml?rev=6448&op=diff
==============================================================================
--- trunk/libparams-classify-perl/META.yml (original)
+++ trunk/libparams-classify-perl/META.yml Fri Aug 10 13:59:51 2007
@@ -1,11 +1,12 @@
 # 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:      0.002
 version_from: lib/Params/Classify.pm
 installdirs:  site
 requires:
+    Scalar::Number:                0.000
     Scalar::Util:                  1.01
 
 distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+generated_by: ExtUtils::MakeMaker version 6.17

Modified: trunk/libparams-classify-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/trunk/libparams-classify-perl/Makefile.PL?rev=6448&op=diff
==============================================================================
--- trunk/libparams-classify-perl/Makefile.PL (original)
+++ trunk/libparams-classify-perl/Makefile.PL Fri Aug 10 13:59:51 2007
@@ -4,6 +4,7 @@
 	NAME => "Params::Classify",
 	VERSION_FROM => "lib/Params/Classify.pm",
 	PREREQ_PM => {
-		"Scalar::Util" => "1.01",
+		Scalar::Number => "0.000",
+		Scalar::Util => "1.01",
 	},
 );

Modified: trunk/libparams-classify-perl/README
URL: http://svn.debian.org/wsvn/trunk/libparams-classify-perl/README?rev=6448&op=diff
==============================================================================
--- trunk/libparams-classify-perl/README (original)
+++ trunk/libparams-classify-perl/README Fri Aug 10 13:59:51 2007
@@ -28,7 +28,7 @@
 
 COPYRIGHT
 
-Copyright (C) 2004, 2006 Andrew Main (Zefram) <zefram at fysh.org>
+Copyright (C) 2004, 2006, 2007 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: trunk/libparams-classify-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libparams-classify-perl/debian/changelog?rev=6448&op=diff
==============================================================================
--- trunk/libparams-classify-perl/debian/changelog (original)
+++ trunk/libparams-classify-perl/debian/changelog Fri Aug 10 13:59:51 2007
@@ -1,3 +1,13 @@
+libparams-classify-perl (0.002-1) unstable; urgency=low
+
+  * New upstream release.
+  * Add libscalar-number-perl to (build) dependencies.
+  * Don't ignore errors from ($MAKE) distclean.
+  * Separate Build-Depends and Build-Depends-Indep.
+  * Include upstream changelog.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at>  Fri, 10 Aug 2007 15:58:27 +0200
+
 libparams-classify-perl (0.001-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libparams-classify-perl/debian/control
URL: http://svn.debian.org/wsvn/trunk/libparams-classify-perl/debian/control?rev=6448&op=diff
==============================================================================
--- trunk/libparams-classify-perl/debian/control (original)
+++ trunk/libparams-classify-perl/debian/control Fri Aug 10 13:59:51 2007
@@ -3,14 +3,15 @@
 Priority: optional
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Florian Ragwitz <florian at mookooh.org>, Joachim Breitner <nomeata at debian.org>, gregor herrmann <gregor+debian at comodo.priv.at>, Carlo Segre <segre at debian.org>
-Build-Depends: debhelper (>= 5.0.0), perl (>= 5.8.3-1)
+Build-Depends: debhelper (>= 5.0.0)
+Build-Depends-Indep: perl (>= 5.8.3-1), libscalar-number-perl
 Standards-Version: 3.7.2
 XS-Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libparams-classify-perl/
 XS-Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libparams-classify-perl/
 
 Package: libparams-classify-perl
 Architecture: all
-Depends: ${perl:Depends}
+Depends: ${perl:Depends}, libscalar-number-perl
 Description: Perl module for argument type classification
  This module provides various type-testing functions. These are intended
  for functions that, unlike most Perl code, care what type of data they

Modified: trunk/libparams-classify-perl/debian/rules
URL: http://svn.debian.org/wsvn/trunk/libparams-classify-perl/debian/rules?rev=6448&op=diff
==============================================================================
--- trunk/libparams-classify-perl/debian/rules (original)
+++ trunk/libparams-classify-perl/debian/rules Fri Aug 10 13:59:51 2007
@@ -22,7 +22,7 @@
 clean:
 	dh_testdir
 	dh_testroot
-	-$(MAKE) realclean
+	[ ! -f Makefile ] || $(MAKE) distclean
 	dh_clean build-stamp configure-stamp
 
 install: build
@@ -41,7 +41,7 @@
 binary-indep: build install
 	dh_testdir
 	dh_testroot
-	dh_installchangelogs 
+	dh_installchangelogs Changes
 	dh_installdocs
 	dh_installman
 	dh_link

Modified: trunk/libparams-classify-perl/lib/Params/Classify.pm
URL: http://svn.debian.org/wsvn/trunk/libparams-classify-perl/lib/Params/Classify.pm?rev=6448&op=diff
==============================================================================
--- trunk/libparams-classify-perl/lib/Params/Classify.pm (original)
+++ trunk/libparams-classify-perl/lib/Params/Classify.pm Fri Aug 10 13:59:51 2007
@@ -6,7 +6,7 @@
 
 	use Params::Classify qw(scalar_class
 		is_undef
-		is_string is_number
+		is_string is_number is_pure_string is_pure_number
 		is_glob
 		is_ref ref_type
 		is_blessed blessed_class
@@ -18,6 +18,8 @@
 
 	$ok = is_string($foo);
 	$ok = is_number($foo);
+	$ok = is_pure_string($foo);
+	$ok = is_pure_number($foo);
 
 	$ok = is_glob($foo);
 
@@ -52,16 +54,16 @@
 use strict;
 
 use Exporter;
-use Scalar::Util 1.10 qw(blessed reftype);
-
-our $VERSION = "0.001";
+use Scalar::Util 1.01 qw(blessed reftype);
+
+our $VERSION = "0.002";
 
 our @ISA = qw(Exporter);
 
 our @EXPORT_OK = qw(
 	scalar_class
 	is_undef
-	is_string is_number
+	is_string is_number is_pure_string is_pure_number
 	is_glob
 	is_ref ref_type
 	is_blessed blessed_class is_strictly_blessed is_able
@@ -180,19 +182,22 @@
 Note that simple (C<is_string>-satisfying) scalars may have independent
 numeric and string values, despite the usual pretence that they have
 only one value.  Such a scalar is deemed to be a number if I<either> it
-already has a numeric value (e.g., was generated by a numeric literal or
-an arithmetic computation) I<or> its string value has acceptable syntax
-for a number (so it can be converted).  Where a scalar has separate
-numeric and string values (see L<Scalar::Util/dualvar>), it is possible
-for it to have an acceptable numeric value while its string value does
-I<not> have acceptable numeric syntax.  Be careful to use such a value
-only in a numeric context, if you are using it as a number.  C<0+ARG>
-is sufficient to collapse it to an ordinary number if you want the
-numeric value in string form.
-
-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>.
+already has a numeric value (e.g., was generated by a numeric literal
+or an arithmetic computation) I<or> its string value has acceptable
+syntax for a number (so it can be converted).  Where a scalar has
+separate numeric and string values (see L<Scalar::Util/dualvar>), it is
+possible for it to have an acceptable numeric value while its string
+value does I<not> have acceptable numeric syntax.  Be careful to use
+such a value only in a numeric context, if you are using it as a number.
+C<scalar_num_part> in L<Scalar::Number> extracts the numeric part of a
+scalar as an ordinary number.  (C<0+ARG> suffices for that unless you
+need to preserve floating point signed zeroes.)
+
+A number may be either a native integer or a native floating point
+value, and there are several subtypes of floating point value.
+For classification, and other handling of numbers in scalars, see
+L<Scalar::Number>.  For details of the two numeric data types, see
+L<Data::Integer> and L<Data::Float>.
 
 This function differs from C<looks_like_number> (see
 L<Scalar::Util/looks_like_number>; also L<perlapi/looks_like_number>
@@ -215,6 +220,42 @@
 	local $SIG{__WARN__} = sub { $warned = 1; };
 	{ no warnings "void"; 0 + $arg; }
 	return !$warned;
+}
+
+=item is_pure_string(ARG)
+
+This returns true iff ARG is defined and an ordinary scalar (i.e.,
+satisfies C<is_string> above) and is fully described by its string value.
+That is, its numeric value is that which would be obtained by automatic
+conversion from the string value.  Such a scalar could have originated
+as a string literal or constructed string.  This excludes many floating
+point number values which stringify lossily.
+
+=cut
+
+sub is_pure_string($) {
+	my($val) = @_;
+	return 0 unless is_string($val);
+	require Scalar::Number;
+	local $SIG{__WARN__} = sub { };
+	return Scalar::Number::sclnum_id_cmp("$val", $val) == 0;
+}
+
+=item is_pure_number(ARG)
+
+This returns true iff ARG is defined and an ordinary scalar (i.e.,
+satisfies C<is_string> above) and is fully described by its numeric value.
+That is, its string value is that which would be obtained by automatic
+conversion from the numeric value.  Such a scalar could have originated
+as a numeric literal or calculated number.  This excludes most strings.
+
+=cut
+
+sub is_pure_number($) {
+	my($val) = @_;
+	return 0 unless is_string($val);
+	require Scalar::Number;
+	return Scalar::Number::scalar_num_part($val) eq $val;
 }
 
 =back
@@ -394,7 +435,9 @@
 =head1 SEE ALSO
 
 L<Data::Float>,
+L<Data::Integer>,
 L<Params::Validate>,
+L<Scalar::Number>,
 L<Scalar::Util>
 
 =head1 AUTHOR
@@ -403,7 +446,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (C) 2004, 2006 Andrew Main (Zefram) <zefram at fysh.org>
+Copyright (C) 2004, 2006, 2007 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.




More information about the Pkg-perl-cvs-commits mailing list