Skip Menu |

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

Report information
The Basics
Id: 2833
Status: resolved
Priority: 0/
Queue: Regexp-Common

People
Owner: Nobody in particular
Requestors: cpan [...] davidhand.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.113
Fixed in: (no value)



Subject: "pattern matches => $sub_ref" doesn't work.
I'm using Regexp::Common 2.113 with Perl 5.8.0 darwin-64int on Mac OS X 10.2.6. The documentation to Regexp::Common says: "matches => $sub_ref" An optional argument that specifies a subroutine that is to be called when the "$RE{...}->matches(...)" method of this pattern is invoked. But in fact, the code doesn't look for "matches => $sub_ref", but "match => $sub_ref". The attached patch against 2.113 should fix that. (I would've tried to patch against the current CVS version, since obviously you use CVS, but I wasn't able to find any information on where the repository is.)
*** /Library/Perl/Regexp/Common.pm Wed Apr 2 16:23:48 2003 --- Common.pm Fri Jun 20 16:09:00 2003 *************** *** 192,198 **** $entry->{__VAL__} = bless { create => $spec{create}, ! match => $spec{match} || \&generic_match, subs => $spec{subs} || \&generic_subs, version => $spec{version}, default => \%default, --- 192,198 ---- $entry->{__VAL__} = bless { create => $spec{create}, ! matches => $spec{matches} || \&generic_matches, subs => $spec{subs} || \&generic_subs, version => $spec{version}, default => \%default, *************** *** 213,225 **** return 1; } ! sub generic_match { $_[0] =~ /$_[1]/ } sub generic_subs { $_[0] =~ s/$_[1]/$_[2]/ } sub matches { my ($self, $str) = @_; my $entry = $self->_decache; ! $entry->{match}->($entry,$str); } sub subs { --- 213,225 ---- return 1; } ! sub generic_matches { $_[0] =~ /$_[1]/ } sub generic_subs { $_[0] =~ s/$_[1]/$_[2]/ } sub matches { my ($self, $str) = @_; my $entry = $self->_decache; ! $entry->{matches}->($entry,$str); } sub subs {
Thank you. This has been fixed in release 20110401701.