summaryrefslogtreecommitdiff
path: root/cpan/Scalar-List-Utils
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2019-10-28 13:14:36 +0000
committerSteve Hay <steve.m.hay@googlemail.com>2019-10-28 13:14:36 +0000
commitbec9d907fa4dc8f7d22a1d056ab1fe14af409949 (patch)
tree6b5869aba8ffdf1ee0198dde2edbc5e63778670e /cpan/Scalar-List-Utils
parent92a915ab903e675cbe7ed2f7508ff3a2cde71186 (diff)
downloadperl-bec9d907fa4dc8f7d22a1d056ab1fe14af409949.tar.gz
Upgrade Scalar-List-Utils from version 1.52 to 1.53
Diffstat (limited to 'cpan/Scalar-List-Utils')
-rw-r--r--cpan/Scalar-List-Utils/ListUtil.xs44
-rw-r--r--cpan/Scalar-List-Utils/lib/List/Util.pm2
-rw-r--r--cpan/Scalar-List-Utils/lib/List/Util/XS.pm2
-rw-r--r--cpan/Scalar-List-Utils/lib/Scalar/Util.pm2
-rw-r--r--cpan/Scalar-List-Utils/lib/Sub/Util.pm2
-rw-r--r--cpan/Scalar-List-Utils/t/blessed.t10
6 files changed, 53 insertions, 9 deletions
diff --git a/cpan/Scalar-List-Utils/ListUtil.xs b/cpan/Scalar-List-Utils/ListUtil.xs
index 5998fe6e4e..b0d98b4470 100644
--- a/cpan/Scalar-List-Utils/ListUtil.xs
+++ b/cpan/Scalar-List-Utils/ListUtil.xs
@@ -124,6 +124,38 @@ my_sv_copypv(pTHX_ SV *const dsv, SV *const ssv)
# define SvNV_nomg SvNV
#endif
+#if PERL_VERSION_GE(5,16,0)
+# define HAVE_UNICODE_PACKAGE_NAMES
+
+# ifndef sv_sethek
+# define sv_sethek(a, b) Perl_sv_sethek(aTHX_ a, b)
+# endif
+
+# ifndef sv_ref
+# define sv_ref(dst, sv, ob) my_sv_ref(aTHX_ dst, sv, ob)
+static SV *
+my_sv_ref(pTHX_ SV *dst, const SV *sv, int ob)
+{
+ /* cargoculted from perl 5.22's sv.c */
+ if(!dst)
+ dst = sv_newmortal();
+
+ if(ob && SvOBJECT(sv)) {
+ if(HvNAME_get(SvSTASH(sv)))
+ sv_sethek(dst, HvNAME_HEK(SvSTASH(sv)));
+ else
+ sv_setpvs(dst, "__ANON__");
+ }
+ else {
+ const char *reftype = sv_reftype(sv, 0);
+ sv_setpv(dst, reftype);
+ }
+
+ return dst;
+}
+# endif
+#endif /* HAVE_UNICODE_PACKAGE_NAMES */
+
enum slu_accum {
ACC_IV,
ACC_NV,
@@ -344,9 +376,9 @@ CODE:
/* else fallthrough */
}
- /* fallthrough to NV now */
retnv = retiv;
accum = ACC_NV;
+ /* FALLTHROUGH */
case ACC_NV:
is_product ? (retnv *= slu_sv_value(sv))
: (retnv += slu_sv_value(sv));
@@ -1310,7 +1342,7 @@ CODE:
ST(0) = boolSV((SvPOK(sv) || SvPOKp(sv)) && (SvNIOK(sv) || SvNIOKp(sv)));
XSRETURN(1);
-char *
+SV *
blessed(sv)
SV *sv
PROTOTYPE: $
@@ -1320,8 +1352,12 @@ CODE:
if(!(SvROK(sv) && SvOBJECT(SvRV(sv))))
XSRETURN_UNDEF;
-
- RETVAL = (char*)sv_reftype(SvRV(sv),TRUE);
+#ifdef HAVE_UNICODE_PACKAGE_NAMES
+ RETVAL = newSVsv(sv_ref(NULL, SvRV(sv), TRUE));
+#else
+ RETVAL = newSV(0);
+ sv_setpv(RETVAL, sv_reftype(SvRV(sv), TRUE));
+#endif
}
OUTPUT:
RETVAL
diff --git a/cpan/Scalar-List-Utils/lib/List/Util.pm b/cpan/Scalar-List-Utils/lib/List/Util.pm
index 9d6f04f427..e1b66c615e 100644
--- a/cpan/Scalar-List-Utils/lib/List/Util.pm
+++ b/cpan/Scalar-List-Utils/lib/List/Util.pm
@@ -15,7 +15,7 @@ our @EXPORT_OK = qw(
all any first min max minstr maxstr none notall product reduce sum sum0 shuffle uniq uniqnum uniqstr
head tail pairs unpairs pairkeys pairvalues pairmap pairgrep pairfirst
);
-our $VERSION = "1.52";
+our $VERSION = "1.53";
our $XS_VERSION = $VERSION;
$VERSION =~ tr/_//d;
diff --git a/cpan/Scalar-List-Utils/lib/List/Util/XS.pm b/cpan/Scalar-List-Utils/lib/List/Util/XS.pm
index b3095547bb..4a7301ca8f 100644
--- a/cpan/Scalar-List-Utils/lib/List/Util/XS.pm
+++ b/cpan/Scalar-List-Utils/lib/List/Util/XS.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
use List::Util;
-our $VERSION = "1.52"; # FIXUP
+our $VERSION = "1.53"; # FIXUP
$VERSION =~ tr/_//d; # FIXUP
1;
diff --git a/cpan/Scalar-List-Utils/lib/Scalar/Util.pm b/cpan/Scalar-List-Utils/lib/Scalar/Util.pm
index c0952bc236..bf670c9cf4 100644
--- a/cpan/Scalar-List-Utils/lib/Scalar/Util.pm
+++ b/cpan/Scalar-List-Utils/lib/Scalar/Util.pm
@@ -17,7 +17,7 @@ our @EXPORT_OK = qw(
dualvar isdual isvstring looks_like_number openhandle readonly set_prototype
tainted
);
-our $VERSION = "1.52";
+our $VERSION = "1.53";
$VERSION =~ tr/_//d;
require List::Util; # List::Util loads the XS
diff --git a/cpan/Scalar-List-Utils/lib/Sub/Util.pm b/cpan/Scalar-List-Utils/lib/Sub/Util.pm
index d50cc8e555..580bd8d136 100644
--- a/cpan/Scalar-List-Utils/lib/Sub/Util.pm
+++ b/cpan/Scalar-List-Utils/lib/Sub/Util.pm
@@ -15,7 +15,7 @@ our @EXPORT_OK = qw(
subname set_subname
);
-our $VERSION = "1.52";
+our $VERSION = "1.53";
$VERSION =~ tr/_//d;
require List::Util; # as it has the XS
diff --git a/cpan/Scalar-List-Utils/t/blessed.t b/cpan/Scalar-List-Utils/t/blessed.t
index 21d3a9ade4..2ae3679196 100644
--- a/cpan/Scalar-List-Utils/t/blessed.t
+++ b/cpan/Scalar-List-Utils/t/blessed.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More tests => 12;
use Scalar::Util qw(blessed);
my $t;
@@ -46,3 +46,11 @@ cmp_ok(blessed($x), "eq", "0", 'blessed HASH-ref');
::is( ::blessed($obj), __PACKAGE__, "blessed on broken isa() and can()" );
}
+SKIP: {
+ # Unicode package names only supported in perl 5.16 onwards
+ skip "Unicode package names are not supported", 1 if $] < 5.016;
+
+ my $utf8_pack= "X\x{100}";
+ my $obj= bless {}, $utf8_pack;
+ ::is( ::blessed($obj), $utf8_pack, "blessed preserves utf8ness for utf8 class names" );
+}