Skip Menu |

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

Report information
The Basics
Id: 78855
Status: new
Priority: 0/
Queue: Text-Balanced

Owner: Nobody in particular
Requestors: florent.angly [...]

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

Subject: Incorrect variable names returned by extract_variable()
Download (untitled) / with headers
text/plain 770b
Hi, When using the extract_variable() function, some of the variable names returned by Text::Balanced are incorrect. The output of the attached script is: foo is (?^:^(km|mi)$) /^(km|mi)$/ foo contains variable names: $) $/ There are two issues: A) The first variable detected, $), is not a valid variable name in Perl. Maybe Text::Balanced could check against the Perl variable naming rules: B) The second variable, $/, is a Perl special variable (, which is fine. However, in the given context, at the end of a regular expression, the dollar sign does not indicate a variable but matches the end of string. Best, Florent
text/x-perl 340b
#! /usr/bin/env perl use strict; use warnings; use Text::Balanced qw(extract_multiple extract_variable); my $foo = qr/^(km|mi)$/ .' '. '/^(km|mi)$/'; print "foo is $foo\n"; print "foo contains variable names:\n"; for my $var_name (extract_multiple($foo,[sub{extract_variable($_[0],'')}],undef,1)) { print " $var_name\n"; } exit;

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to