Re: how to specify "useithreads" in a distroprefs

[email protected] (Slaven Rezic)
Newsgroups perl.cpan.testers.discuss
Message-ID <[email protected]>
12. 06. 2022. u 20:42, Alceu Rodrigues de Freitas Junior via 
cpan-testers-discuss piše:

> Hello Slaven,
>
> On 09/06/2022 16:57, Slaven Rezic wrote:
>>
>> 09. 06. 2022. u 21:38, Slaven Rezic piše:
>>
>>> Hi Alceu,
>>>
>>> I think that
>>>
>>>     useithreads: undef
>>>
>>> should work, using exactly the string which is returned by
>>>
>>>     perl -V:useithreads
>>>
>>>
>> Actually, looking at this distropref file 
>> https://github.com/eserte/srezic-cpan-distroprefs/blob/8c3ae5d7b4071f9639ccfcea4f44764c2699e27e/Devel-CallParser.yml#L5 
>> it seems that the value is interepreted as a regexp, so you want to 
>> anchor it with ^ and $ for extra safety.
>>
> I'm afraid that neither the options you proposed: I tried both and the 
> result is the same: Kwalify doesn't complain anymore but the 
> distribution is not skipped.
>
> On the other hand, using:
>
>     useithreads: null
>
> Generates the opposite outcome.
>
> Not sure how Kwalify works (both Ruby's and Perl's implementation from 
> it), but the direct translation from Perl's undef would be null in YAML.
>
Hi Alceu,

Kwalify is just a schema for validating data structures and it does not 
do any parsing or matching using the distroprefs data. The latter is 
done by CPAN::Distroprefs.

That said, I tried "useithreads: undef" and it did not work. So it looks 
like the matching is not done against what is displayed in "perl -V" (in 
this case the string "undef"), but what is in the Config data structure 
(the value undef).

However, the distroprefs code only does regexp matches against the 
stringified values, so to match the stringified undef (the empty string) 
one has to use '^$'. Below is a distroprefs file just for demonstration 
purposes, and it works on my system.

Regards, Slaven

---
match:
   distribution: Kwalify
   perlconfig:
     useithreads: '^$'
pl:
   commandline: "echo unthreaded perl deteted; exit 1"
---
match:
   distribution: Kwalify
   perlconfig:
     useithreads: '^define$'
pl:
   commandline: "echo threading perl deteted; exit 1"
---
match:
   distribution: Kwalify
pl:
   commandline: "echo nothing matched; exit 1"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.