LibreCat / Catmandu

Catmandu - a data processing toolkit
https://librecat.org
177 stars 31 forks source link

syntax error at .../Catmandu-1.2021-0/blib/lib/Catmandu/Fix/Condition/in.pm line 28, near "] ~" (smartmatch deprecation?) #399

Closed eserte closed 1 month ago

eserte commented 1 month ago

With perl 5.41.x (e.g. 5.41.4) the test suite fails:

#   Failed test 'use Catmandu::Fix::Condition::in;'
#   at t/Catmandu-Fix-Condition-in.t line 13.
#     Tried to use 'Catmandu::Fix::Condition::in'.
#     Error:  syntax error at /home/e/eserte/.cpan/build/2024092916/Catmandu-1.2021-0/blib/lib/Catmandu/Fix/Condition/in.pm line 28, near "] ~"
# Execution of /home/e/eserte/.cpan/build/2024092916/Catmandu-1.2021-0/blib/lib/Catmandu/Fix/Condition/in.pm aborted due to compilation errors.
# Compilation failed in require at t/Catmandu-Fix-Condition-in.t line 13.
# BEGIN failed--compilation aborted at t/Catmandu-Fix-Condition-in.t line 13.
Can't locate object method "pass_fixes" via package "Catmandu::Fix::Condition::in" at t/Catmandu-Fix-Condition-in.t line 17.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 1.
t/Catmandu-Fix-Condition-in.t ............ 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/1 subtests 

I did not do further research, but this looks like being caused by smartmatch removal from perl.

phochste commented 1 month ago

Thanks 1.2022 is on its way to cpanm.

nics commented 1 month ago

This library is probably better than a homebrew smart match replacement https://toby.ink/blog/2023/07/14/matching-simply/#:~:text=If%20you're%20looking%20for,isn't%20going%20to%20disappear.

phochste commented 1 month ago

@nics I tried Toby Inkster's match::simple but it does not pass the Catmandu tests that tested all features of Catmandu::Fix::Condition::in with smartmatching.

In particular it fails to find out if two arrays match.

https://github.com/LibreCat/Catmandu/blob/dev/t/Catmandu-Fix-Condition-in.t#L44

https://github.com/LibreCat/Catmandu/blob/dev/t/Catmandu-Fix-Condition-in.t#L53

His Syntax::Operator::Matches as I understand from the blog post relies on perl 5.38 and uses the same logic as match::simple.