Skip Menu |

This queue is for tickets about the Text-Balanced CPAN distribution.

Report information
The Basics
Id: 30883
Status: open
Priority: 0/
Queue: Text-Balanced

People
Owner: Nobody in particular
Requestors: whatever [...] davidnicol.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 1.95
  • 1.97
  • 1.98
  • 2.01
  • 2.02
Fixed in: (no value)



Subject: misinterpreting division slash as implied $_=~m//
So I'm testing my source filter, on cygwin 5.8.7 with text::balanced v. 1.95 (no version.pm; can't upgrade to v2.0.0, but this issue does not appear to appear in RT bugs) macro plusmeansminus left+right {left-right}; macro plusmeansminus left / right {left+right}; pass ('macro syntax including punctuation'); is((37-30), (plusmeansminus (7 + 15 * 2) + 30), "syntax triggered sig"); is((37+30), (plusmeansminus (7 + 15 * 2) / 30), "alternate syn trgrd sig"); and I get everything from left to 30 excised as a quotelike. I don't know what Perl's heuristic about when to interpret slash as implying a match against $_ is, but this is not correct behavior: $ perl -MO=Deparse /tmp/dubious.pl 'plusmeansminus'->macro('left' + do { 'left' - 'right' }->right); 'plusmeansminus'->macro('left' / do { 'left' + 'right' }->right); pass('macro syntax including pynctuation'); is(7, plusmeansminus(37) + 30, 'syntax triggered sig'); is(67, plusmeansminus(37) / 30, 'alternate syn trgrd sig'); /tmp/dubious.pl syntax OK Has the heuristic been revised since v1.95? (Macrame.pm teaser: the tests now pass using @ instead of / )
Subject: dubious.pl
macro plusmeansminus left+right {left-right}; macro plusmeansminus left / right {left+right}; pass ('macro syntax including pynctuation'); is((37-30), (plusmeansminus (7 + 15 * 2) + 30), "syntax triggered sig"); is((37+30), (plusmeansminus (7 + 15 * 2) / 30), "alternate syn trgrd sig");
For reference, this problem appears to be present in v2.02
of Text::Balanced as reported from the following problem
arising with Filter::Simple and its usage of extract_quotelike:

  https://rt.perl.org/rt3/Public/Bug/Display.html?id=92438

Apologies for the original report to the wrong bug tracker.
I did not realize Text::Balanced CPAN was upstream of that
in the perl5 distribution.

BTW, is there any way to determine that for a given module
in the perl core module set?

Regards,
Chris
Is there any plan to expose the ability of _match_quotelike()
where $allow_raw_match can be set to extract_quotelike()?

If not, I will need to fork a version of Text::Balanced that will.

Thanks in advance,
Chris

On Wed Oct 12 17:05:43 2011, CHM wrote:
Show quoted text
> For reference, this problem appears to be present in v2.02
> of Text::Balanced as reported from the following problem
> arising with Filter::Simple and its usage of extract_quotelike:
>
> https://rt.perl.org/rt3/Public/Bug/Display.html?id=92438
>
> Apologies for the original report to the wrong bug tracker.
> I did not realize Text::Balanced CPAN was upstream of that
> in the perl5 distribution.
>
> BTW, is there any way to determine that for a given module
> in the perl core module set?
>
> Regards,
> Chris


I started to work on a patch for this fix but wasn't
sure what the best way to do so.  Reviewing the
versions of Text::Balanced on CPAN shows the
current behavior is present back to 2003 (and probably
earlier).

The simplest fix might be to modify the prototype for
extract_quotelike to (;$$$$) where the last two values
would then be passed directly to _match_quotelike()
as the last two args.  I believe that would not break
the previous usage but would allow extract_quotelike
to *not* match // without an m in front.

If this would be acceptable, I would be willing to make
a patch for the changes to code, docs, and tests.

Thanks,
Chris

On Mon Jul 16 18:38:50 2012, CHM wrote:
Show quoted text
> Is there any plan to expose the ability of _match_quotelike()
> where $allow_raw_match can be set to extract_quotelike()?
>
> If not, I will need to fork a version of Text::Balanced that will.
>
> Thanks in advance,
> Chris
>
> On Wed Oct 12 17:05:43 2011, CHM wrote:
> > For reference, this problem appears to be present in v2.02
> > of Text::Balanced as reported from the following problem
> > arising with Filter::Simple and its usage of extract_quotelike:
> >
> > https://rt.perl.org/rt3/Public/Bug/Display.html?id=92438
> >
> > Apologies for the original report to the wrong bug tracker.
> > I did not realize Text::Balanced CPAN was upstream of that
> > in the perl5 distribution.
> >
> > BTW, is there any way to determine that for a given module
> > in the perl core module set?
> >
> > Regards,
> > Chris