Skip to content

Commit

Permalink
Ensure no name collisions for supported parens
Browse files Browse the repository at this point in the history
  • Loading branch information
GuiltyDolphin committed Jul 11, 2016
1 parent f56fd2c commit 594eebf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/DDG/GoodieRole/Parse/List.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use List::Util qw( all pairs );
use Data::Record;
use Regexp::Common;

my @parens = (
my @supported_parens = (
'[' => ']',
'(' => ')',
'{' => '}',
Expand All @@ -28,7 +28,7 @@ sub get_separator {

sub remove_parens {
my $text = shift;
foreach (pairs @parens) {
foreach (pairs @supported_parens) {
my ($opening, $closing) = map { quotemeta $_ } @$_;
next unless $text =~ /^$RE{balanced}{-parens=>"$opening$closing"}$/;
$text =~ s/^$opening(.*?)$closing$/$1/;
Expand Down Expand Up @@ -106,7 +106,7 @@ sub format_list {
my $parens = $options{parens} // '[]';
my $join = $options{join} // ', ';
my $join_last = $options{join_last} // $join;
@parens = ref $parens eq 'ARRAY'
my @parens = ref $parens eq 'ARRAY'
? @$parens : split '', $parens;
# In the case the user uses parens => '' we don't want to
# display *any* parentheses, so we need to have 'fake'
Expand Down

0 comments on commit 594eebf

Please sign in to comment.