r45446 - in /branches/upstream/libparams-classify-perl/current: Build.PL Changes META.yml Makefile.PL SIGNATURE lib/Params/Classify.pm lib/Params/Classify.xs t/check.t t/classify.t t/ref.t
bricas-guest at users.alioth.debian.org
bricas-guest at users.alioth.debian.org
Wed Oct 7 20:00:10 UTC 2009
Author: bricas-guest
Date: Wed Oct 7 19:59:59 2009
New Revision: 45446
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=45446
Log:
[svn-upgrade] Integrating new upstream version, libparams-classify-perl (0.009)
Modified:
branches/upstream/libparams-classify-perl/current/Build.PL
branches/upstream/libparams-classify-perl/current/Changes
branches/upstream/libparams-classify-perl/current/META.yml
branches/upstream/libparams-classify-perl/current/Makefile.PL
branches/upstream/libparams-classify-perl/current/SIGNATURE
branches/upstream/libparams-classify-perl/current/lib/Params/Classify.pm
branches/upstream/libparams-classify-perl/current/lib/Params/Classify.xs
branches/upstream/libparams-classify-perl/current/t/check.t
branches/upstream/libparams-classify-perl/current/t/classify.t
branches/upstream/libparams-classify-perl/current/t/ref.t
Modified: branches/upstream/libparams-classify-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparams-classify-perl/current/Build.PL?rev=45446&op=diff
==============================================================================
--- branches/upstream/libparams-classify-perl/current/Build.PL (original)
+++ branches/upstream/libparams-classify-perl/current/Build.PL Wed Oct 7 19:59:59 2009
@@ -1,3 +1,4 @@
+{ use 5.006; }
use warnings;
use strict;
Modified: branches/upstream/libparams-classify-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparams-classify-perl/current/Changes?rev=45446&op=diff
==============================================================================
--- branches/upstream/libparams-classify-perl/current/Changes (original)
+++ branches/upstream/libparams-classify-perl/current/Changes Wed Oct 7 19:59:59 2009
@@ -1,3 +1,14 @@
+version 0.009; 2009-10-07
+
+ * port to Perl 5.11.0, supporting the addition of first-class regexp
+ objects (which are actually a type of scalar) and the removal of
+ the distinct RV type; new functions is_regexp() and check_regexp()
+
+ * fix a test skip count in t/ref.t, which was causing false test
+ failures on Perl 5.6
+
+ * check for required Perl version at runtime
+
version 0.008; 2009-09-10
* add "check_" functions for argument checking
Modified: branches/upstream/libparams-classify-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparams-classify-perl/current/META.yml?rev=45446&op=diff
==============================================================================
--- branches/upstream/libparams-classify-perl/current/META.yml (original)
+++ branches/upstream/libparams-classify-perl/current/META.yml Wed Oct 7 19:59:59 2009
@@ -1,6 +1,6 @@
---
name: Params-Classify
-version: 0.008
+version: 0.009
author:
- 'Andrew Main (Zefram) <zefram at fysh.org>'
abstract: argument type classification
@@ -26,8 +26,8 @@
provides:
Params::Classify:
file: lib/Params/Classify.pm
- version: 0.008
-generated_by: Module::Build version 0.31012
+ version: 0.009
+generated_by: Module::Build version 0.280801
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.2.html
version: 1.2
Modified: branches/upstream/libparams-classify-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparams-classify-perl/current/Makefile.PL?rev=45446&op=diff
==============================================================================
--- branches/upstream/libparams-classify-perl/current/Makefile.PL (original)
+++ branches/upstream/libparams-classify-perl/current/Makefile.PL Wed Oct 7 19:59:59 2009
@@ -1,4 +1,4 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.31012
+# Note: this file was auto-generated by Module::Build::Compat version 0.2808_01
require 5.006;
unless (eval "use Module::Build::Compat 0.02; 1" ) {
Modified: branches/upstream/libparams-classify-perl/current/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparams-classify-perl/current/SIGNATURE?rev=45446&op=diff
==============================================================================
--- branches/upstream/libparams-classify-perl/current/SIGNATURE (original)
+++ branches/upstream/libparams-classify-perl/current/SIGNATURE Wed Oct 7 19:59:59 2009
@@ -15,32 +15,32 @@
Hash: SHA1
SHA1 9f070b5a5dcc2d53447a0f43584eb219aa686f66 .cvsignore
-SHA1 af9e5b1f29110f0da0caeb7aaeb81a2e2db77f90 Build.PL
-SHA1 7f22b1fad104a6069fdee4c364cdfe81dfcc4fca Changes
+SHA1 ac032bc697cfb90a5c3befe6ae81ea33f27226af Build.PL
+SHA1 00875ad7987e07c923e8b7ea8b05bf0ed07cbccd Changes
SHA1 f9620d343525ff1fc3e3f35e77171716b97c557c MANIFEST
-SHA1 44d3dbd62ec71bec373531328053535348b96c33 META.yml
-SHA1 684ab827ae5405876abe203f5a032ffa6b575cf7 Makefile.PL
+SHA1 b8fe1ad99bf3075e702a6c0dc74e6584fb8e186d META.yml
+SHA1 34fe1b08005c6feb5ed84bd22456347fe2032f4b Makefile.PL
SHA1 104090ec719f91482eaa564c826c250c45b21a59 README
SHA1 91978573e906c90b93752e0733ef8e875f0d1b89 lib/Params/.cvsignore
-SHA1 110b914b92d8c563c285ef55c7d305c6c32bd779 lib/Params/Classify.pm
-SHA1 3dc87b4c68948f498a219dbbde6c848eff3492e2 lib/Params/Classify.xs
+SHA1 5eaa23d5ec2542a3497f869a2d88742732ea6033 lib/Params/Classify.pm
+SHA1 e05ab9aa13db9a19dd430421ef853dd14b9da5c8 lib/Params/Classify.xs
SHA1 4b8cdbbfd1dea667bdd61a8b9621109c68e0dc7a t/blessed.t
SHA1 a3d9a389510faf3bfecb4860a14813988a0eddcd t/blessed_pp.t
-SHA1 06f47b8c6c9dbc6619277e761d83e591bb35630c t/check.t
+SHA1 05aff9d44d733979b0bd8f566d1cb27fe7bd1657 t/check.t
SHA1 ec88f98f2f29c1a6999db46666e5eb7cf9fa46b1 t/check_pp.t
-SHA1 ef874cda555050e9b75701ec602c53504f11383c t/classify.t
+SHA1 ca5ae17f55bba5a9a9a76285447704e4a922b643 t/classify.t
SHA1 22c8bb9af38f3eaa604350884e3fcc9c200b5f1b t/classify_pp.t
SHA1 3250e576c589744c9b3ef63c93b13d8ba6a5933f t/error.t
SHA1 fc008cb61eb02798d6ec02df230ef4d59bcdca12 t/error_pp.t
SHA1 0e141eecf3ca4903ef38d9413b5403a9ddb0392f t/pod_cvg.t
SHA1 74a957cd8b93f25672ecc6aa578a671d084dd343 t/pod_syn.t
-SHA1 6828ed75aa6f7af1834b1022ea314301ebbff6aa t/ref.t
+SHA1 d7e84d9429f7f167d69badae1cef27137b1480f4 t/ref.t
SHA1 4a19b745e2bcdfb8db18b149e79fcf8c235b24f8 t/ref_pp.t
SHA1 2159e80bde44de0eac1d90b83b57ae9681876519 t/setup_pp.pl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
-iEYEARECAAYFAkqpWI4ACgkQOV9mt2VyAVEsTgCfVkyB6lSNfkbV33Vn0iCMD+OO
-rLIAn161OTMNxdXxQekRYMYpEKQFt3kq
-=o6b7
+iEYEARECAAYFAkrL/2gACgkQOV9mt2VyAVF0mACeKswRGJ7JvBo++ArdsBMEd74L
+sPAAn3tqeaFBN2/RpWJ9Joi1ovN+cIQ+
+=3u9E
-----END PGP SIGNATURE-----
Modified: branches/upstream/libparams-classify-perl/current/lib/Params/Classify.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparams-classify-perl/current/lib/Params/Classify.pm?rev=45446&op=diff
==============================================================================
--- branches/upstream/libparams-classify-perl/current/lib/Params/Classify.pm (original)
+++ branches/upstream/libparams-classify-perl/current/lib/Params/Classify.pm Wed Oct 7 19:59:59 2009
@@ -10,6 +10,7 @@
is_string check_string
is_number check_number
is_glob check_glob
+ is_regexp check_regexp
is_ref check_ref ref_type
is_blessed check_blessed blessed_class
is_strictly_blessed check_strictly_blessed
@@ -28,6 +29,8 @@
if(is_glob($arg)) {
check_glob($arg);
+ if(is_regexp($arg)) {
+ check_regexp($arg);
if(is_ref($arg)) {
check_ref($arg);
@@ -71,10 +74,11 @@
package Params::Classify;
+{ use 5.006; }
use warnings;
use strict;
-our $VERSION = "0.008";
+our $VERSION = "0.009";
use parent "Exporter";
our @EXPORT_OK = qw(
@@ -83,6 +87,7 @@
is_string check_string
is_number check_number
is_glob check_glob
+ is_regexp check_regexp
is_ref check_ref ref_type
is_blessed check_blessed blessed_class
is_strictly_blessed check_strictly_blessed
@@ -148,6 +153,10 @@
=item *
+regexp (first-class regular expression objects in Perl 5.11 onwards)
+
+=item *
+
reference to unblessed object (further classified by physical data type
of the referenced object)
@@ -181,8 +190,8 @@
=item scalar_class(ARG)
Determines which of the five classes described above I<ARG> falls into.
-Returns "B<UNDEF>", "B<STRING>", "B<GLOB>", "B<REF>", or "B<BLESSED>"
-accordingly.
+Returns "B<UNDEF>", "B<STRING>", "B<GLOB>", "B<REGEXP>", "B<REF>", or
+"B<BLESSED>" accordingly.
=cut
@@ -227,8 +236,8 @@
=item check_string(ARG)
-Check whether I<ARG> is defined and is an ordinary scalar value
-(not a reference or a typeglob). This is what one usually thinks of as a
+Check whether I<ARG> is defined and is an ordinary scalar value (not a
+reference, typeglob, or regexp). This is what one usually thinks of as a
string in Perl. In fact, any scalar (including C<undef> and references)
can be coerced to a string, but if you're trying to classify a scalar
then you don't want to do that.
@@ -303,6 +312,26 @@
=back
+=head2 Regexps
+
+=over
+
+=item is_regexp(ARG)
+
+=item check_regexp(ARG)
+
+Check whether I<ARG> is a regexp object.
+
+=cut
+
+sub is_regexp($) { reftype(\$_[0]) eq "REGEXP" }
+
+sub check_regexp($) {
+ die "argument is not a regexp\n" unless &is_regexp;
+}
+
+=back
+
=head2 References to Unblessed Objects
=over
@@ -345,6 +374,7 @@
SCALAR => "SCALAR",
LVALUE => "SCALAR",
GLOB => "SCALAR",
+ REGEXP => "SCALAR",
ARRAY => "ARRAY",
HASH => "HASH",
CODE => "CODE",
Modified: branches/upstream/libparams-classify-perl/current/lib/Params/Classify.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparams-classify-perl/current/lib/Params/Classify.xs?rev=45446&op=diff
==============================================================================
--- branches/upstream/libparams-classify-perl/current/lib/Params/Classify.xs (original)
+++ branches/upstream/libparams-classify-perl/current/lib/Params/Classify.xs Wed Oct 7 19:59:59 2009
@@ -2,17 +2,29 @@
#include "perl.h"
#include "XSUB.h"
+#define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
+#define PERL_DECIMAL_VERSION \
+ PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
+#define PERL_VERSION_GE(r,v,s) \
+ (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
+
#ifndef HvNAME_get
# define HvNAME_get(hv) HvNAME(hv)
#endif
-#define sv_is_undef(sv) (SvTYPE(sv) != SVt_PVGV && !SvOK(sv))
+#define sv_is_glob(sv) (SvTYPE(sv) == SVt_PVGV)
+
+#if PERL_VERSION_GE(5,11,0)
+# define sv_is_regexp(sv) (SvTYPE(sv) == SVt_REGEXP)
+#else /* <5.11.0 */
+# define sv_is_regexp(sv) 0
+#endif /* <5.11.0 */
+
+#define sv_is_undef(sv) (!sv_is_glob(sv) && !sv_is_regexp(sv) && !SvOK(sv))
#define sv_is_string(sv) \
- (SvTYPE(sv) != SVt_PVGV && \
+ (!sv_is_glob(sv) && !sv_is_regexp(sv) && \
(SvFLAGS(sv) & (SVf_IOK|SVf_NOK|SVf_POK|SVp_IOK|SVp_NOK|SVp_POK)))
-
-#define sv_is_glob(sv) (SvTYPE(sv) == SVt_PVGV)
static svtype
read_reftype(SV *reftype)
@@ -83,9 +95,15 @@
{
svtype t = SvTYPE(referent);
switch(SvTYPE(referent)) {
- case SVt_NULL: case SVt_IV: case SVt_NV: case SVt_RV:
+ case SVt_NULL: case SVt_IV: case SVt_NV:
+#if !PERL_VERSION_GE(5,11,0)
+ case SVt_RV:
+#endif /* <5.11.0 */
case SVt_PV: case SVt_PVIV: case SVt_PVNV:
case SVt_PVMG: case SVt_PVLV: case SVt_PVGV:
+#if PERL_VERSION_GE(5,11,0)
+ case SVt_REGEXP:
+#endif /* >=5.11.0 */
return SVt_NULL;
case SVt_PVAV: case SVt_PVHV: case SVt_PVCV: case SVt_PVFM:
case SVt_PVIO:
@@ -150,8 +168,10 @@
scalar_class(SV *arg)
PROTOTYPE: $
CODE:
- if(SvTYPE(arg) == SVt_PVGV) {
+ if(sv_is_glob(arg)) {
RETVAL = "GLOB";
+ } else if(sv_is_regexp(arg)) {
+ RETVAL = "REGEXP";
} else if(!SvOK(arg)) {
RETVAL = "UNDEF";
} else if(SvROK(arg)) {
@@ -206,6 +226,21 @@
CODE:
if(!sv_is_glob(arg))
croak("argument is not a typeglob\n");
+
+bool
+is_regexp(SV *arg)
+PROTOTYPE: $
+CODE:
+ RETVAL = !!sv_is_regexp(arg);
+OUTPUT:
+ RETVAL
+
+void
+check_regexp(SV *arg)
+PROTOTYPE: $
+CODE:
+ if(!sv_is_regexp(arg))
+ croak("argument is not a regexp\n");
bool
is_ref(SV *arg, SV *type_sv = 0)
Modified: branches/upstream/libparams-classify-perl/current/t/check.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparams-classify-perl/current/t/check.t?rev=45446&op=diff
==============================================================================
--- branches/upstream/libparams-classify-perl/current/t/check.t (original)
+++ branches/upstream/libparams-classify-perl/current/t/check.t Wed Oct 7 19:59:59 2009
@@ -1,11 +1,11 @@
use warnings;
use strict;
-use Test::More tests => 1 + 16*17;
+use Test::More tests => 1 + 17*18;
BEGIN {
use_ok "Params::Classify", map { ("is_$_", "check_$_") } qw(
- undef string number glob
+ undef string number glob regexp
ref blessed strictly_blessed able
);
}
@@ -23,6 +23,7 @@
"0 but true",
"1ab",
*STDOUT,
+ ${qr/xyz/},
\"",
\\"",
[],
@@ -41,6 +42,8 @@
is $@, is_number($_) ? "" : "argument is not a number\n";
eval { check_glob($_); };
is $@, is_glob($_) ? "" : "argument is not a typeglob\n";
+ eval { check_regexp($_); };
+ is $@, is_regexp($_) ? "" : "argument is not a regexp\n";
eval { check_ref($_); };
is $@, is_ref($_) ? "" :
"argument is not a reference to plain object\n";
Modified: branches/upstream/libparams-classify-perl/current/t/classify.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparams-classify-perl/current/t/classify.t?rev=45446&op=diff
==============================================================================
--- branches/upstream/libparams-classify-perl/current/t/classify.t (original)
+++ branches/upstream/libparams-classify-perl/current/t/classify.t Wed Oct 7 19:59:59 2009
@@ -1,32 +1,36 @@
-use Test::More tests => 71;
+use Test::More tests => 1 + 8*11;
BEGIN {
use_ok "Params::Classify", qw(
scalar_class is_undef is_string
- is_number is_glob is_ref is_blessed
+ is_number is_glob is_regexp is_ref is_blessed
);
}
-sub test_scalar_classification($$$$$$$$) {
- my($scalar, $class, $iu, $is, $in, $ig, $ir, $ib) = @_;
- is(scalar_class($scalar), $class);
- is(!!is_undef($scalar), !!$iu);
- is(!!is_string($scalar), !!$is);
- is(!!is_number($scalar), !!$in);
- is(!!is_glob($scalar), !!$ig);
- is(!!is_ref($scalar), !!$ir);
- is(!!is_blessed($scalar), !!$ib);
+sub test_scalar_classification($$$$$$$$$) {
+ my(undef, $class, $iu, $is, $in, $ig, $ix, $ir, $ib) = @_;
+ is(scalar_class($_[0]), $class);
+ is(!!is_undef($_[0]), !!$iu);
+ is(!!is_string($_[0]), !!$is);
+ is(!!is_number($_[0]), !!$in);
+ is(!!is_glob($_[0]), !!$ig);
+ is(!!is_regexp($_[0]), !!$ix);
+ is(!!is_ref($_[0]), !!$ir);
+ is(!!is_blessed($_[0]), !!$ib);
}
-test_scalar_classification(undef, "UNDEF", 1, 0, 0, 0, 0, 0);
-test_scalar_classification("", "STRING", 0, 1, 0, 0, 0, 0);
-test_scalar_classification("abc", "STRING", 0, 1, 0, 0, 0, 0);
-test_scalar_classification(123, "STRING", 0, 1, 1, 0, 0, 0);
-test_scalar_classification(0, "STRING", 0, 1, 1, 0, 0, 0);
-test_scalar_classification("0 but true", "STRING", 0, 1, 1, 0, 0, 0);
-test_scalar_classification("1ab", "STRING", 0, 1, 0, 0, 0, 0);
-test_scalar_classification(*STDOUT, "GLOB", 0, 0, 0, 1, 0, 0);
-test_scalar_classification({}, "REF", 0, 0, 0, 0, 1, 0);
-test_scalar_classification(bless({}, "main"), "BLESSED", 0, 0, 0, 0, 0, 1);
+test_scalar_classification(undef, "UNDEF", 1, 0, 0, 0, 0, 0, 0);
+test_scalar_classification("", "STRING", 0, 1, 0, 0, 0, 0, 0);
+test_scalar_classification("abc", "STRING", 0, 1, 0, 0, 0, 0, 0);
+test_scalar_classification(123, "STRING", 0, 1, 1, 0, 0, 0, 0);
+test_scalar_classification(0, "STRING", 0, 1, 1, 0, 0, 0, 0);
+test_scalar_classification("0 but true", "STRING", 0, 1, 1, 0, 0, 0, 0);
+test_scalar_classification("1ab", "STRING", 0, 1, 0, 0, 0, 0, 0);
+test_scalar_classification(*STDOUT, "GLOB", 0, 0, 0, 1, 0, 0, 0);
+SKIP: { skip "no first-class regexps", 8 unless $] >= 5.011;
+test_scalar_classification(${qr/xyz/}, "REGEXP", 0, 0, 0, 0, 1, 0, 0);
+}
+test_scalar_classification({}, "REF", 0, 0, 0, 0, 0, 1, 0);
+test_scalar_classification(bless({}, "main"), "BLESSED", 0, 0, 0, 0, 0, 0, 1);
1;
Modified: branches/upstream/libparams-classify-perl/current/t/ref.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparams-classify-perl/current/t/ref.t?rev=45446&op=diff
==============================================================================
--- branches/upstream/libparams-classify-perl/current/t/ref.t (original)
+++ branches/upstream/libparams-classify-perl/current/t/ref.t Wed Oct 7 19:59:59 2009
@@ -1,4 +1,4 @@
-use Test::More tests => 97;
+use Test::More tests => 1 + 8*12;
BEGIN { use_ok "Params::Classify", qw(is_ref ref_type); }
@@ -32,7 +32,7 @@
SKIP: {
my $format = *foo{FORMAT};
- skip "this Perl doesn't do *foo{FORMAT}", 9 unless defined $format;
+ skip "this Perl doesn't do *foo{FORMAT}", 8 unless defined $format;
test_ref_type($format, "FORMAT");
}
More information about the Pkg-perl-cvs-commits
mailing list