This queue is for tickets about the Regexp-Grammars CPAN distribution.

Report information
The Basics
Id:
100848
Status:
resolved
Priority:
Low/Low

People
Owner:
DCONWAY [...] cpan.org
Requestors:
SWUECHO [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Critical
Broken in:
1.036
Fixed in:
(no value)



Subject: Regexp::Grammars does not clear RULE_HANDLER properly after match fails
#!/usr/bin/env perl use v5.20; package MyAction { sub new { return bless {}, shift; } sub text { my ($self, $result) = @_; warn "\n-->auto action is called"; return $result; } } my $test_grammar = do { use Regexp::Grammars; qr{ <text> <rule: text> \w+ }x; }; say "auto action should be called"; "abc_test" =~ $test_grammar->with_actions(MyAction->new); say; say "no auto action provided, so auto action will not ba called"; "abc_test" =~ $test_grammar; say; say "match fail, so auto action should not ba called"; '$$$' =~ $test_grammar->with_actions(MyAction->new); say; say "no auto action provided, so auto action should not ba called"; say "However, becuase the RULE_HANLDLER is not cleared, after match, auto action is called"; "abc_test" =~ $test_grammar __DATA__ perl -v This is perl 5, version 20, subversion 0 (v5.20.0) built for x86_64-linux perl -MRegexp::Grammars -E 'say $Regexp::Grammars::VERSION' 1.036
please see the last part: say "no auto action provided, so auto action should not ba called"; say "However, becuase the RULE_HANLDLER is not cleared, after match, auto action is called"; "abc_test" =~ $test_grammar the $RULE_HANLDER from previous match is not cleared. On Wed Dec 10 19:11:14 2014, SWUECHO wrote:
Show quoted text
> #!/usr/bin/env perl > use v5.20; > > package MyAction { > sub new { > return bless {}, shift; > } > > sub text { > my ($self, $result) = @_; > warn "\n-->auto action is called"; > return $result; > } > > } > > my $test_grammar = do { > use Regexp::Grammars; > qr{ > <text> > <rule: text> \w+ > }x; > > }; > > say "auto action should be called"; > "abc_test" =~ $test_grammar->with_actions(MyAction->new); > say; > say "no auto action provided, so auto action will not ba called"; > "abc_test" =~ $test_grammar; > say; > say "match fail, so auto action should not ba called"; > '$$$' =~ $test_grammar->with_actions(MyAction->new); > say; > say "no auto action provided, so auto action should not ba called"; > say "However, becuase the RULE_HANLDLER is not cleared, after match, > auto action is called"; > "abc_test" =~ $test_grammar > > __DATA__ > perl -v > > This is perl 5, version 20, subversion 0 (v5.20.0) built for x86_64- > linux > > perl -MRegexp::Grammars -E 'say $Regexp::Grammars::VERSION' > 1.036
Subject: Re: [rt.cpan.org #100848] Regexp::Grammars does not clear RULE_HANDLER properly after match fails
Date: Thu, 11 Dec 2014 14:40:11 +1100
To: bug-Regexp-Grammars@rt.cpan.org
From: Damian Conway <damian@conway.org>
Thank-you for this report. I apologize for the bug. I have now uploaded a new release which I believe solves the problem. All the best, Damian
Subject: Re: [rt.cpan.org #100848] Regexp::Grammars does not clear RULE_HANDLER properly after match fails
Date: Wed, 10 Dec 2014 20:25:58 -0800
To: bug-Regexp-Grammars@rt.cpan.org
From: Hao Wu <hwu@intellisurvey.com>
great!  surprised to get the reply in such a short time. Thanks!

Best,

Hao

On Wed, Dec 10, 2014 at 7:41 PM, damian@conway.org via RT <bug-Regexp-Grammars@rt.cpan.org> wrote:
Show quoted text
<URL: https://rt.cpan.org/Ticket/Display.html?id=100848 >

Thank-you for this report.
I apologize for the bug.
I have now uploaded a new release which I believe solves the problem.

All the best,

Damian




This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.