G'day perlancar,
Noting the "use 5.020000;" in your code, and the versions you used for testing, I attempted to replicate your results using a variety of versions. Unfortunately, other than "use 5.020000;" correctly barring a 5.18.0 test, pretty much everything else blew up in my face.
My CSelTest.pm is a [download] copy of your posted code. I ran the tests like this:
$ perl -MCSelTest -MData::Dump -E 'dd CSelTest::parse(q{ [attr] })'
Here's the results:
Successfully tested: use VERSION
Perl v5.20.0 required--this is only v5.18.0, stopped at CSelTest.pm li +ne 3. BEGIN failed--compilation aborted at CSelTest.pm line 3. Compilation failed in require. BEGIN failed--compilation aborted.
Both tests unsuccessful. Result: PANIC!
panic: memory wrap at CSelTest.pm line 107. Compilation failed in require. BEGIN failed--compilation aborted.
Both tests unsuccessful. Result: FATAL!
Switch (?(condition)... not terminated in regex; marked by <-- HERE in + m/ (?&ATTR_SELECTOR) (?{ $_ = $^R->[1] }) (?(DEFINE) ... ) # DEFINE <-- HERE / at CSelTest.pm line 107. Compilation failed in require. BEGIN failed--compilation aborted.
I suspect some sort of copy/paste error; please address.
Here's another possible copy/paste error:
% perl -I. -Ilib -MCSelTest -MData::Dump -E'dd( CSelTest::parse_csel(q +{ [attr=1] }) )' [[{ name => "attr" }], "eq", 1]
That's the same output as the next test with [attr eq 1]. For [attr=1], I would've expected '"="', rather than '"eq"', in the output; i.e.
% perl -I. -Ilib -MCSelTest -MData::Dump -E'dd( CSelTest::parse_csel(q +{ [attr=1] }) )' [[{ name => "attr" }], "=", 1]
— Ken
In reply to Re: Weirdness (duplicated data) while building result during parsing using regex
by kcott
in thread Weirdness (duplicated data) while building result during parsing using regex
by perlancar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |