Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package perl-XS-Parse-Sublike for
openSUSE:Factory checked in at 2025-12-20 21:47:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-XS-Parse-Sublike (Old)
and /work/SRC/openSUSE:Factory/.perl-XS-Parse-Sublike.new.1928 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-XS-Parse-Sublike"
Sat Dec 20 21:47:11 2025 rev:5 rq:1323812 version:0.410.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-XS-Parse-Sublike/perl-XS-Parse-Sublike.changes
2025-11-28 16:56:23.507025581 +0100
+++
/work/SRC/openSUSE:Factory/.perl-XS-Parse-Sublike.new.1928/perl-XS-Parse-Sublike.changes
2025-12-20 21:49:59.227875497 +0100
@@ -1,0 +2,11 @@
+Wed Dec 10 05:38:05 UTC 2025 - Tina Müller <[email protected]>
+
+- updated to 0.410.0 (0.41)
+ see /usr/share/doc/packages/perl-XS-Parse-Sublike/Changes
+
+ 0.41 2025-12-09
+ [CHANGES]
+ * Support optional refalias parameters with defaulting expressions
+ * Support named refalias parameters
+
+-------------------------------------------------------------------
Old:
----
XS-Parse-Sublike-0.40.tar.gz
New:
----
XS-Parse-Sublike-0.41.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-XS-Parse-Sublike.spec ++++++
--- /var/tmp/diff_new_pack.MW3Y5r/_old 2025-12-20 21:49:59.795899013 +0100
+++ /var/tmp/diff_new_pack.MW3Y5r/_new 2025-12-20 21:49:59.799899179 +0100
@@ -18,10 +18,10 @@
%define cpan_name XS-Parse-Sublike
Name: perl-XS-Parse-Sublike
-Version: 0.400.0
+Version: 0.410.0
Release: 0
-# 0.40 -> normalize -> 0.400.0
-%define cpan_version 0.40
+# 0.41 -> normalize -> 0.410.0
+%define cpan_version 0.41
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: XS functions to assist in parsing sub-like syntax
URL: https://metacpan.org/release/%{cpan_name}
++++++ XS-Parse-Sublike-0.40.tar.gz -> XS-Parse-Sublike-0.41.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/Changes
new/XS-Parse-Sublike-0.41/Changes
--- old/XS-Parse-Sublike-0.40/Changes 2025-11-14 18:44:07.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/Changes 2025-12-09 18:01:18.000000000 +0100
@@ -1,5 +1,10 @@
Revision history for XS-Parse-Sublike
+0.41 2025-12-09
+ [CHANGES]
+ * Support optional refalias parameters with defaulting expressions
+ * Support named refalias parameters
+
0.40 2025-11-14
[CHANGES]
* Experimentally support refalias syntax in extended signatures
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/MANIFEST
new/XS-Parse-Sublike-0.41/MANIFEST
--- old/XS-Parse-Sublike-0.40/MANIFEST 2025-11-14 18:44:07.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/MANIFEST 2025-12-09 18:01:18.000000000 +0100
@@ -36,7 +36,7 @@
t/05func-sig-attributes.t
t/06func-conditional-default.t
t/07func-lexical.t
-t/08func-refs.t
+t/08func-refalias.t
t/10stages-permit.t
t/11stages-pre_subparse.t
t/12stages-post_blockstart.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/META.json
new/XS-Parse-Sublike-0.41/META.json
--- old/XS-Parse-Sublike-0.40/META.json 2025-11-14 18:44:07.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/META.json 2025-12-09 18:01:18.000000000 +0100
@@ -40,15 +40,15 @@
"provides" : {
"Sublike::Extended" : {
"file" : "lib/Sublike/Extended.pm",
- "version" : "0.40"
+ "version" : "0.41"
},
"XS::Parse::Sublike" : {
"file" : "lib/XS/Parse/Sublike.pm",
- "version" : "0.40"
+ "version" : "0.41"
},
"XS::Parse::Sublike::Builder" : {
"file" : "lib/XS/Parse/Sublike/Builder.pm",
- "version" : "0.40"
+ "version" : "0.41"
}
},
"release_status" : "stable",
@@ -57,6 +57,6 @@
"http://dev.perl.org/licenses/"
]
},
- "version" : "0.40",
+ "version" : "0.41",
"x_serialization_backend" : "JSON::PP version 4.16"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/META.yml
new/XS-Parse-Sublike-0.41/META.yml
--- old/XS-Parse-Sublike-0.40/META.yml 2025-11-14 18:44:07.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/META.yml 2025-12-09 18:01:18.000000000 +0100
@@ -18,17 +18,17 @@
provides:
Sublike::Extended:
file: lib/Sublike/Extended.pm
- version: '0.40'
+ version: '0.41'
XS::Parse::Sublike:
file: lib/XS/Parse/Sublike.pm
- version: '0.40'
+ version: '0.41'
XS::Parse::Sublike::Builder:
file: lib/XS/Parse/Sublike/Builder.pm
- version: '0.40'
+ version: '0.41'
requires:
File::ShareDir: '1.00'
perl: '5.016'
resources:
license: http://dev.perl.org/licenses/
-version: '0.40'
+version: '0.41'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/lib/Sublike/Extended.pm
new/XS-Parse-Sublike-0.41/lib/Sublike/Extended.pm
--- old/XS-Parse-Sublike-0.40/lib/Sublike/Extended.pm 2025-11-14
18:44:07.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/lib/Sublike/Extended.pm 2025-12-09
18:01:18.000000000 +0100
@@ -3,7 +3,7 @@
#
# (C) Paul Evans, 2023-2024 -- [email protected]
-package Sublike::Extended 0.40;
+package Sublike::Extended 0.41;
use v5.14;
use warnings;
@@ -154,14 +154,42 @@
I<by reference> from the caller.
Refaliased variables may be scalars, arrays, or hashes. For argument handling
-purposes each will act like a mandatory positional scalar which consumes a
-reference to a variable of the matching type. If the caller does not pass a
-reference, or a reference to a mismatched type of variable, an exception is
-thrown as part of argument handling in the signature.
+purposes each will act like a positional scalar which consumes a reference to
+a variable of the matching type. If the caller does not pass a reference, or a
+reference to a mismatched type of variable, an exception is thrown as part of
+argument handling in the signature.
+
+I<Since version 0.41> named parameters may also use refalias assignment, using
+the syntax C<:\VAR> - such as C<:\@items>.
+
+As with other parameters, a defaulting expression can be provided, which makes
+the parameter optional for the caller. If the caller does not provide a
+corresponding value, this value is used as if the caller passed it. In this
+case, note that the defaulting expression must still yield a I<reference to> a
+container of the appropriate shape to match the declared parameter variable.
+While all of the C<=>, C<//=> and C<||=> operators can be used here, because
+the value must be a reference, it is unlikely that the distinction between
+testing for definedness vs boolean truth will be useful.
+
+Note that I<as of version 0.41> optional named refalias parameters are
+allowed, but a limitation of the implementation means that if a corresponding
+value for the parameter is not provided by the caller and the defaulting
+expression yields a reference to an incompatible variable, the resulting
+exception message fails to identify the name of the variable involved; instead
+just quoting three questionmarks:
+
+=for highlighter
+
+ $ perl -E 'use Sublike::Extended "sub"; sub f ( :\@arr = \undef ) {} f()'
+ refaliases are experimental at -e line 1.
+ Expected named argument '???' to main::f to be a reference to ARRAY at -e
line 1.
+
+=for highlighter language=perl
The body of the function can see the value stored by the referred variable
and make modifications to it. Any such modifications will be reflected in the
-variable whose reference was passed by the caller.
+variable whose reference was passed by the caller, or the value created by the
+defaulting expression if it was used.
=head1 KEYWORDS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/XS-Parse-Sublike-0.40/lib/XS/Parse/Sublike/Builder.pm
new/XS-Parse-Sublike-0.41/lib/XS/Parse/Sublike/Builder.pm
--- old/XS-Parse-Sublike-0.40/lib/XS/Parse/Sublike/Builder.pm 2025-11-14
18:44:07.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/lib/XS/Parse/Sublike/Builder.pm 2025-12-09
18:01:18.000000000 +0100
@@ -3,7 +3,7 @@
#
# (C) Paul Evans, 2020-2024 -- [email protected]
-package XS::Parse::Sublike::Builder 0.40;
+package XS::Parse::Sublike::Builder 0.41;
use v5.14;
use warnings;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/lib/XS/Parse/Sublike.pm
new/XS-Parse-Sublike-0.41/lib/XS/Parse/Sublike.pm
--- old/XS-Parse-Sublike-0.40/lib/XS/Parse/Sublike.pm 2025-11-14
18:44:07.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/lib/XS/Parse/Sublike.pm 2025-12-09
18:01:18.000000000 +0100
@@ -3,7 +3,7 @@
#
# (C) Paul Evans, 2020-2024 -- [email protected]
-package XS::Parse::Sublike 0.40;
+package XS::Parse::Sublike 0.41;
use v5.14;
use warnings;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/src/parse_subsignature_ex.c
new/XS-Parse-Sublike-0.41/src/parse_subsignature_ex.c
--- old/XS-Parse-Sublike-0.40/src/parse_subsignature_ex.c 2025-11-14
18:44:07.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/src/parse_subsignature_ex.c 2025-12-09
18:01:18.000000000 +0100
@@ -188,17 +188,32 @@
RETURN;
}
-static XOP xop_namedargassign;
-static OP *pp_namedargassign(pTHX)
+#define check_refalias_arg(priv, sv) S_check_refalias_arg(aTHX_ priv, sv)
+static bool S_check_refalias_arg(pTHX_ U8 priv, SV *sv)
{
- dSP;
- dTARGET;
- SV *value = POPs;
+ if(!sv || !SvROK(sv))
+ return false;
- SvPADSTALE_off(TARG);
- SvSetMagicSV(TARG, value);
+ SV *rv = SvRV(sv);
- RETURN;
+ switch(priv & OPpARGELEM_MASK) {
+ case OPpARGELEM_SV:
+ if(SvTYPE(rv) > SVt_PVMG)
+ return false;
+ break;
+
+ case OPpARGELEM_AV:
+ if(SvTYPE(rv) != SVt_PVAV)
+ return false;
+ break;
+
+ case OPpARGELEM_HV:
+ if(SvTYPE(rv) != SVt_PVHV)
+ return false;
+ break;
+ }
+
+ return true;
}
struct ArgElemsNamedParam {
@@ -209,10 +224,64 @@
const char *namepv;
};
enum {
+ /* These flags are also stored in op_private of some ops so they have to
+ * fit in U8
+ */
NAMEDPARAMf_REQUIRED = (1<<0),
NAMEDPARAMf_UTF8 = (1<<1),
+ NAMEDPARAMf_REFALIAS = (1<<2),
+
+ NAMEDPARAMf_REFSCALAR = (1<<3),
+ NAMEDPARAMf_REFARRAY = (2<<3),
+ NAMEDPARAMf_REFHASH = (3<<3),
};
+#define do_namedarg_assign(flags, padix, name, val)
S_do_namedarg_assign(aTHX_ flags, padix, name, val)
+static void S_do_namedarg_assign(pTHX_ U8 flags, PADOFFSET padix, SV *name, SV
*val)
+{
+ SV **padentry = &PAD_SVl(padix);
+
+ /* This has to do all the work normally done by pp_argelem */
+ assert(TAINTING_get || !TAINT_get);
+ if(UNLIKELY(TAINT_get) && !SvTAINTED(val))
+ TAINT_NOT;
+
+ if(flags & NAMEDPARAMf_REFALIAS) {
+ const char *exp_reftype = NULL;
+ U8 priv = 0;
+ switch(flags & NAMEDPARAMf_REFHASH) {
+ case NAMEDPARAMf_REFSCALAR: priv = OPpARGELEM_SV; exp_reftype =
"SCALAR"; break;
+ case NAMEDPARAMf_REFARRAY: priv = OPpARGELEM_AV; exp_reftype = "ARRAY";
break;
+ case NAMEDPARAMf_REFHASH: priv = OPpARGELEM_HV; exp_reftype = "HASH";
break;
+ }
+ if(!check_refalias_arg(priv, val)) {
+ if(!name)
+ // TODO: Look up the param name from the padix... somehow?
+ name = newSVpvs_flags("???", SVs_TEMP);
+ croak_from_caller("Expected named argument '%" SVf "' to %" SVf " to be
a reference to %s",
+ SVfARG(name), SVfARG(S_find_runcv_name(aTHX)), exp_reftype);
+ }
+
+ SvREFCNT_dec(*padentry);
+ *padentry = SvREFCNT_inc(SvRV(val));
+ }
+ else
+ SvSetMagicSV(*padentry, val);
+
+ SvPADSTALE_off(*padentry);
+}
+
+static XOP xop_namedargassign;
+static OP *pp_namedargassign(pTHX)
+{
+ dSP;
+ SV *val = POPs;
+
+ do_namedarg_assign(PL_op->op_private, PL_op->op_targ, NULL, val);
+
+ RETURN;
+}
+
static int cmp_argelemsnamedparam(const void *_a, const void *_b)
{
const struct ArgElemsNamedParam *a = _a, *b = _b;
@@ -303,8 +372,6 @@
U32 namehash;
PERL_HASH(namehash, namepv, namelen);
- PADOFFSET param_padix = 0;
-
/* In theory we would get better performance at runtime by binary
* searching for a good starting index. In practice only actually starts
* saving measurable time once we start to get to literally hundreds of
@@ -313,36 +380,30 @@
* If your perl function wants to declare hundreds of different named
* parameters you probably want to rethink your strategy. ;)
*/
+ struct ArgElemsNamedParam *param = NULL;
for(parami = 0; parami < n_params; parami++) {
- struct ArgElemsNamedParam *param = &aux->params[parami];
+ struct ArgElemsNamedParam *p = &aux->params[parami];
/* Since the params are stored in hash key order, if we are already
* past it then we know we are done
*/
- if(param->namehash > namehash)
+ if(p->namehash > namehash)
break;
- if(param->namehash != namehash)
+ if(p->namehash != namehash)
continue;
/* TODO: This will be wrong for UTF-8 comparisons */
- if(namelen != param->namelen)
+ if(namelen != p->namelen)
continue;
- if(!strnEQ(namepv, param->namepv, namelen))
+ if(!strnEQ(namepv, p->namepv, namelen))
continue;
- param_padix = param->padix;
+ param = p;
break;
}
- if(param_padix) {
- SV *targ = PAD_SVl(param_padix);
-
- /* This has to do all the work normally done by pp_argelem */
- assert(TAINTING_get || !TAINT_get);
- if(UNLIKELY(TAINT_get) && !SvTAINTED(val))
- TAINT_NOT;
- SvPADSTALE_off(targ);
- SvSetMagicSV(targ, val);
+ if(param) {
+ do_namedarg_assign(param->flags, param->padix, name, val);
}
else if(slurpy_hv) {
hv_store_ent(slurpy_hv, name, newSVsv(val), 0);
@@ -426,6 +487,8 @@
opdump_printf(ctx, "%sUTF8", need_comma?",":""), need_comma = true;
if(param->flags & NAMEDPARAMf_REQUIRED)
opdump_printf(ctx, "%sREQUIRED", need_comma?",":""), need_comma = true;
+ if(param->flags & NAMEDPARAMf_REFALIAS)
+ opdump_printf(ctx, "%sREFALIAS", need_comma?",":""), need_comma = true;
opdump_printf(ctx, ")}\n");
}
@@ -435,42 +498,36 @@
static XOP xop_refargelem;
static OP *pp_refargelem(pTHX)
{
+ dSP;
U8 priv = PL_op->op_private;
IV argix = PTR2IV(cUNOP_AUX->op_aux);
- SV **svp = av_fetch(GvAV(PL_defgv), argix, FALSE);
- if(!svp || !SvROK(*svp))
- croak_from_caller("Expected argument %" IVdf " to %" SVf " to be a
reference",
- argix + 1, SVfARG(S_find_runcv_name(aTHX)));
-
- SV *rv = SvRV(*svp);
-
- const char *exp_reftype = NULL;
- switch(priv & OPpARGELEM_MASK) {
- case OPpARGELEM_SV:
- if(SvTYPE(rv) > SVt_PVMG)
- exp_reftype = "SCALAR";
- break;
+ SV *sv;
+ if(PL_op->op_flags & OPf_STACKED)
+ sv = POPs;
+ else {
+ SV **svp = av_fetch(GvAV(PL_defgv), argix, FALSE);
+ sv = svp ? *svp : NULL;
+ }
- case OPpARGELEM_AV:
- if(SvTYPE(rv) != SVt_PVAV)
- exp_reftype = "ARRAY";
- break;
+ PUTBACK;
- case OPpARGELEM_HV:
- if(SvTYPE(rv) != SVt_PVHV)
- exp_reftype = "HASH";
- break;
- }
- if(exp_reftype)
+ if(!check_refalias_arg(priv, sv)) {
+ const char *exp_reftype = NULL;
+ switch(priv & OPpARGELEM_MASK) {
+ case OPpARGELEM_SV: exp_reftype = "SCALAR"; break;
+ case OPpARGELEM_AV: exp_reftype = "ARRAY"; break;
+ case OPpARGELEM_HV: exp_reftype = "HASH"; break;
+ }
croak_from_caller("Expected argument %" IVdf " to %" SVf " to be a
reference to %s",
argix + 1, SVfARG(S_find_runcv_name(aTHX)), exp_reftype);
+ }
/* Perform refaliasing into the pad */
SV **padentry = &(PAD_SVl(PL_op->op_targ));
save_clearsv(padentry);
SvREFCNT_dec(*padentry);
- *padentry = SvREFCNT_inc(rv);
+ *padentry = SvREFCNT_inc(SvRV(sv));
return PL_op->op_next;
}
@@ -530,7 +587,8 @@
struct NamedParamDetails {
PADOFFSET padix;
- bool is_required;
+ U8 flags;
+ char sigil;
};
struct SignatureParsingContext {
OP *positional_elems; /* OP_LINESEQ of every positional element, in order */
@@ -566,9 +624,19 @@
Newx(details, 1, struct NamedParamDetails);
*details = (struct NamedParamDetails){
.padix = paramctx->padix,
- .is_required = !paramctx->defop,
+ .flags = (!paramctx->defop) ? NAMEDPARAMf_REQUIRED : 0,
+ .sigil = paramctx->sigil,
};
+ if(paramctx->is_refalias) {
+ details->flags |= NAMEDPARAMf_REFALIAS;
+ switch(paramctx->sigil) {
+ case '$': details->flags |= NAMEDPARAMf_REFSCALAR; break;
+ case '@': details->flags |= NAMEDPARAMf_REFARRAY; break;
+ case '%': details->flags |= NAMEDPARAMf_REFHASH; break;
+ }
+ }
+
hv_store(sigctx->named_details, paramctx->namepv, paramctx->namelen,
newSVpvx(details), 0);
}
@@ -590,6 +658,8 @@
newSTATEOP(0, NULL, paramctx->op));
sigctx->n_elems++;
+ if(paramctx->defop)
+ sigctx->n_optelems++;
}
else if(paramctx->sigil == '$') {
/* A positional scalar */
@@ -699,6 +769,10 @@
c = lex_peek_unichar(0);
}
+ /* Be slightly helpful to folks who write \:$foo */
+ if((flags & PARSE_SUBSIGNATURE_NAMED_PARAMS) && c == ':')
+ croak("Named refalias parameters should be written :\\VAR, not \\:VAR");
+
paramctx.sigil = c;
switch(paramctx.sigil) {
case '$': private = OPpARGELEM_SV; break;
@@ -802,8 +876,6 @@
if(lex_consume("=") ||
(default_if_undef = lex_consume("//=")) ||
(default_if_false = lex_consume("||="))) {
- if(paramctx.is_refalias)
- croak("Cannot supply a defaulting expression to a refalias parameter");
OP *defexpr = parse_termexpr(PARSE_OPTIONAL);
if(PL_parser->error_count)
croak("Expected a defaulting expression for optional parameter");
@@ -817,6 +889,14 @@
OP *assignop = newUNOP(OP_CUSTOM, 0, defexpr);
assignop->op_ppaddr = &pp_namedargassign;
assignop->op_targ = paramctx.padix;
+ if(paramctx.is_refalias) {
+ assignop->op_private |= NAMEDPARAMf_REFALIAS;
+ switch(paramctx.sigil) {
+ case '$': assignop->op_private |= NAMEDPARAMf_REFSCALAR; break;
+ case '@': assignop->op_private |= NAMEDPARAMf_REFARRAY; break;
+ case '%': assignop->op_private |= NAMEDPARAMf_REFHASH; break;
+ }
+ }
OP *existsop = (OP *)alloc_LOGOP(OP_CUSTOM, assignop,
LINKLIST(assignop));
existsop->op_ppaddr = &pp_namedargexists;
@@ -1003,9 +1083,8 @@
struct NamedParamDetails *details = (struct NamedParamDetails
*)SvPVX(HeVAL(iter));
*param = (struct ArgElemsNamedParam){
- .flags =
- (HeUTF8(iter) ? NAMEDPARAMf_UTF8 : 0) |
- (details->is_required ? NAMEDPARAMf_REQUIRED : 0),
+ .flags = details->flags |
+ (HeUTF8(iter) ? NAMEDPARAMf_UTF8 : 0),
.padix = details->padix,
.namehash = HeHASH(iter),
.namepv = savepvn(namepv, namelen),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/t/04func-named-params.t
new/XS-Parse-Sublike-0.41/t/04func-named-params.t
--- old/XS-Parse-Sublike-0.40/t/04func-named-params.t 2025-11-14
18:44:07.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/t/04func-named-params.t 2025-12-09
18:01:18.000000000 +0100
@@ -150,4 +150,7 @@
'result of invoking function with unnamed slurpy hash' );
}
+# refalias named parameters are tested in a later test script, along with
+# other refalias
+
done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/t/08func-refalias.t
new/XS-Parse-Sublike-0.41/t/08func-refalias.t
--- old/XS-Parse-Sublike-0.40/t/08func-refalias.t 1970-01-01
01:00:00.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/t/08func-refalias.t 2025-12-09
18:01:18.000000000 +0100
@@ -0,0 +1,96 @@
+#!/usr/bin/perl
+
+use v5.14;
+use warnings;
+
+use Test2::V0 0.000147; # is_oneref
+BEGIN {
+ $] >= 5.026000 or plan skip_all => "No parse_subsignature()";
+}
+
+use feature 'signatures';
+no warnings 'experimental';
+
+use lib "t";
+use testcase "t::func";
+
+BEGIN { $^H{"t::func/rfunc"}++ }
+
+{
+ rfunc totals(\@array, \%hash) {
+ return scalar @array + scalar keys %hash;
+ }
+
+ is( totals( [10, 11], {a => "A"} ), 3,
+ 'func with refalias invoked');
+
+ like( dies { totals( {}, {} ) },
+ qr/^Expected argument 1 to main::totals to be a reference to ARRAY at /,
+ 'Exception thrown by wrong reference type' );
+ like( dies { totals( [], [] ) },
+ qr/^Expected argument 2 to main::totals to be a reference to HASH at /,
+ 'Exception thrown by wrong reference type' );
+}
+
+# refalias parameters can have defaults
+{
+ rfunc add_them_all(\@arr = [1, 2]) {
+ my $n = 0;
+ $n += $_ for @arr;
+ return $n;
+ }
+
+ is( add_them_all(), 3, 'refalias with default applies when
absent' );
+ is( add_them_all( [ 4, 5 ] ), 9, 'refalias param default can be overridden'
);
+
+ rfunc default_explodes(\@arr = die "This should not be invoked") { }
+
+ ok( lives { default_explodes( [] ) },
+ 'Defaulting expression of refalias parameter is not invoked with passed
value' );
+}
+
+# refaliased variables can be edited in place
+{
+ rfunc inc_all(\@arr) {
+ $_++ for @arr;
+ }
+
+ my @array = ( 1, 2, 3 );
+ inc_all \@array;
+ is( \@array, [ 2, 3, 4 ],
+ 'refalias func can mutate caller-passed container' );
+
+ my $arr = [];
+ inc_all $arr;
+ is_oneref( $arr, '$arr has one reference after refaliasing call' );
+}
+
+# refalias on named parameters
+{
+ rfunc refnamed_scalar( :\$scl ) { return 0 + !!defined $scl; }
+ rfunc refnamed_array ( :\@arr ) { return scalar @arr; }
+ rfunc refnamed_hash ( :\%hsh ) { return scalar keys %hsh; }
+
+ is( refnamed_scalar( scl => \1 ), 1,
+ 'Refalias named scalar parameter' );
+ is( refnamed_array( arr => ['x', 'y', 'z'] ), 3,
+ 'Refalias named array parameter' );
+ is( refnamed_hash( hsh => { x => 1, y => 2 } ), 2,
+ 'Refalias named hash parameter' );
+
+ like( dies { refnamed_array() },
+ qr/^Missing argument 'arr' for subroutine main::refnamed_array at /,
+ 'complaint from missing named param' );
+}
+
+# refalias named can have defaults
+{
+ rfunc refnamed_maybe_array( :\@arr = [2] ) { return $arr[0]; }
+
+ is( refnamed_maybe_array( ), 2,
+ 'Refalias named array parameter default applies' );
+ is( refnamed_maybe_array( arr => [5] ), 5,
+ 'Refalias named array parameter with value overrides default' );
+}
+
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/t/08func-refs.t
new/XS-Parse-Sublike-0.41/t/08func-refs.t
--- old/XS-Parse-Sublike-0.40/t/08func-refs.t 2025-11-14 18:44:07.000000000
+0100
+++ new/XS-Parse-Sublike-0.41/t/08func-refs.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,51 +0,0 @@
-#!/usr/bin/perl
-
-use v5.14;
-use warnings;
-
-use Test2::V0 0.000147; # is_oneref
-BEGIN {
- $] >= 5.026000 or plan skip_all => "No parse_subsignature()";
-}
-
-use feature 'signatures';
-no warnings 'experimental';
-
-use lib "t";
-use testcase "t::func";
-
-BEGIN { $^H{"t::func/rfunc"}++ }
-
-{
- rfunc totals(\@array, \%hash) {
- return scalar @array + scalar keys %hash;
- }
-
- is( totals( [10, 11], {a => "A"} ), 3,
- 'func with refalias invoked');
-
- like( dies { totals( {}, {} ) },
- qr/^Expected argument 1 to main::totals to be a reference to ARRAY at /,
- 'Exception thrown by wrong reference type' );
- like( dies { totals( [], [] ) },
- qr/^Expected argument 2 to main::totals to be a reference to HASH at /,
- 'Exception thrown by wrong reference type' );
-}
-
-# refaliased variables can be edited in place
-{
- rfunc inc_all(\@arr) {
- $_++ for @arr;
- }
-
- my @array = ( 1, 2, 3 );
- inc_all \@array;
- is( \@array, [ 2, 3, 4 ],
- 'refalias func can mutate caller-passed container' );
-
- my $arr = [];
- inc_all $arr;
- is_oneref( $arr, '$arr has one reference after refaliasing call' );
-}
-
-done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/XS-Parse-Sublike-0.40/t/func.xs
new/XS-Parse-Sublike-0.41/t/func.xs
--- old/XS-Parse-Sublike-0.40/t/func.xs 2025-11-14 18:44:07.000000000 +0100
+++ new/XS-Parse-Sublike-0.41/t/func.xs 2025-12-09 18:01:18.000000000 +0100
@@ -35,7 +35,7 @@
static const struct XSParseSublikeHooks parse_rfunc_hooks = {
.ver = XSPARSESUBLIKE_ABI_VERSION,
.permit_hintkey = "t::func/rfunc",
- .flags = XS_PARSE_SUBLIKE_FLAG_SIGNATURE_REFALIAS,
+ .flags =
XS_PARSE_SUBLIKE_FLAG_SIGNATURE_NAMED_PARAMS|XS_PARSE_SUBLIKE_FLAG_SIGNATURE_REFALIAS,
};
static const struct XSParseSublikeHooks parse_nafunc_hooks = {
++++++ _scmsync.obsinfo ++++++
--- /var/tmp/diff_new_pack.MW3Y5r/_old 2025-12-20 21:50:00.023908452 +0100
+++ /var/tmp/diff_new_pack.MW3Y5r/_new 2025-12-20 21:50:00.035908949 +0100
@@ -1,6 +1,6 @@
-mtime: 1763184769
-commit: 6f6e4022d76e15158a61264bb86efefdc597b789a791d1d0c527114a26897b00
+mtime: 1765345085
+commit: 28ef79f99cbaf483f0db3f52052dd0b5ffe23382d86c306582035f76a3d1ff7c
url: https://src.opensuse.org/perl/perl-XS-Parse-Sublike.git
-revision: 6f6e4022d76e15158a61264bb86efefdc597b789a791d1d0c527114a26897b00
+revision: 28ef79f99cbaf483f0db3f52052dd0b5ffe23382d86c306582035f76a3d1ff7c
projectscmsync: https://src.opensuse.org/perl/_ObsPrj
++++++ build.specials.obscpio ++++++
++++++ build.specials.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/.gitignore 2025-12-13 00:15:33.000000000 +0100
@@ -0,0 +1 @@
+.osc