Skip to content

Commit

Permalink
Scalar::List::Utils: ' not special in names from v5.41
Browse files Browse the repository at this point in the history
  • Loading branch information
tonycoz committed Jun 19, 2024
1 parent 197e7dc commit da78887
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
8 changes: 8 additions & 0 deletions cpan/Scalar-List-Utils/ListUtil.xs
Original file line number Diff line number Diff line change
Expand Up @@ -1947,8 +1947,10 @@ PREINIT:
STRLEN namelen;
const char* nameptr = SvPV(name, namelen);
int utf8flag = SvUTF8(name);
#if PERL_VERSION_LT(5, 41, 0)
int quotes_seen = 0;
bool need_subst = FALSE;
#endif
PPCODE:
if (!SvROK(sub) && SvGMAGICAL(sub))
mg_get(sub);
Expand All @@ -1971,19 +1973,24 @@ PPCODE:
if (s > nameptr && *s == ':' && s[-1] == ':') {
end = s - 1;
begin = ++s;
#if PERL_VERSION_LT(5, 41, 0)
if (quotes_seen)
need_subst = TRUE;
#endif
}
#if PERL_VERSION_LT(5, 41, 0)
else if (s > nameptr && *s != '\0' && s[-1] == '\'') {
end = s - 1;
begin = s;
if (quotes_seen++)
need_subst = TRUE;
}
#endif
}
s--;
if (end) {
SV* tmp;
#if PERL_VERSION_LT(5, 41, 0)
if (need_subst) {
STRLEN length = end - nameptr + quotes_seen - (*end == '\'' ? 1 : 0);
char* left;
Expand All @@ -2002,6 +2009,7 @@ PPCODE:
stash = gv_stashpvn(left, length, GV_ADD | utf8flag);
}
else
#endif
stash = gv_stashpvn(nameptr, end - nameptr, GV_ADD | utf8flag);
nameptr = begin;
namelen -= begin - nameptr;
Expand Down
2 changes: 1 addition & 1 deletion cpan/Scalar-List-Utils/lib/List/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ our @EXPORT_OK = qw(
sample shuffle uniq uniqint uniqnum uniqstr zip zip_longest zip_shortest mesh mesh_longest mesh_shortest
head tail pairs unpairs pairkeys pairvalues pairmap pairgrep pairfirst
);
our $VERSION = "1.63";
our $VERSION = "1.63_01";
our $XS_VERSION = $VERSION;
$VERSION =~ tr/_//d;

Expand Down
2 changes: 1 addition & 1 deletion cpan/Scalar-List-Utils/lib/List/Util/XS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use strict;
use warnings;
use List::Util;

our $VERSION = "1.63"; # FIXUP
our $VERSION = "1.63_01"; # FIXUP
$VERSION =~ tr/_//d; # FIXUP

1;
Expand Down
2 changes: 1 addition & 1 deletion cpan/Scalar-List-Utils/lib/Scalar/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ our @EXPORT_OK = qw(
dualvar isdual isvstring looks_like_number openhandle readonly set_prototype
tainted
);
our $VERSION = "1.63";
our $VERSION = "1.63_01";
$VERSION =~ tr/_//d;

require List::Util; # List::Util loads the XS
Expand Down
2 changes: 1 addition & 1 deletion cpan/Scalar-List-Utils/lib/Sub/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ our @EXPORT_OK = qw(
subname set_subname
);

our $VERSION = "1.63";
our $VERSION = "1.63_01";
$VERSION =~ tr/_//d;

require List::Util; # as it has the XS
Expand Down
5 changes: 3 additions & 2 deletions cpan/Scalar-List-Utils/t/exotic_names.t
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ sub caller3_ok {
),
);

$expected =~ s/'/::/g;
$expected =~ s/'/::/g if $] < 5.041;

# this is apparently how things worked before 5.16
utf8::encode($expected) if $] < 5.016 and $ord > 255;
Expand Down Expand Up @@ -83,7 +83,8 @@ push @ordinal,

plan tests => @ordinal * 2 * 3;

my $legal_ident_char = "A-Z_a-z0-9'";
my $legal_ident_char = "A-Z_a-z0-9";
$legal_ident_char .= "'" if $] < 5.041;
$legal_ident_char .= join '', map chr, 0x100, 0x498
unless $] < 5.008;

Expand Down

0 comments on commit da78887

Please sign in to comment.