Skip Menu |

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

Report information
The Basics
Id: 48408
Status: resolved
Priority: 0/
Queue: Regexp-Parser

People
Owner: Nobody in particular
Requestors: wyant [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.02
Fixed in: (no value)



Subject: The visual() method appears not to format POSIX character classes correctly
With Regexp::Parser 0.20 (the only one on CPAN as of the filing of this report), my $regex = Regexp::Parser->new('[[:alpha:]]'); print $regex->visual(), "\n" produces "[[SCALAR(0x81d280)alphaSCALAR(0x81d280)]]" as output. If I understand the docs correctly, the output should be "[[:alpha:]]". The attached patch file is one way to make this happen. Thank you for your time and attention. Tom Wyant
Subject: regexp_parser_objects.patch
--- lib/Regexp/Parser/Objects.old 2005-05-22 19:39:01.000000000 -0400 +++ lib/Regexp/Parser/Objects.pm 2009-08-03 23:03:28.000000000 -0400 @@ -381,8 +381,11 @@ $self->{data}->type; } else { - join "", $self->{how}, ($self->{neg} ? '^' : ''), - $self->{type}, $self->{how}; + my $how = ref $self->{how} eq 'SCALAR' ? + ${ $self->{how} } : + $self->{how}; + join "", $how, ($self->{neg} ? '^' : ''), + $self->{type}, $how; } } @@ -404,8 +407,11 @@ $self->{data}->visual; } else { - join "", "[", $self->{how}, ($self->{neg} ? '^' : ''), - $self->{type}, $self->{how}, "]"; + my $how = ref $self->{how} eq 'SCALAR' ? + ${ $self->{how} } : + $self->{how}; + join "", "[", $how, ($self->{neg} ? '^' : ''), + $self->{type}, $how, "]"; } } }
I'll take a look at providing a dev release with this patch if it's good on Tuesday.
Also needs a test before it can go in.