Permalink
Browse files

fix bug w/ multiple ENV substitions in `spice to`

was accidentally attempting to replace the same variable during each
loop iteration. now uses the newly found variable.
  • Loading branch information...
1 parent 7ed02ae commit 6c1c2aa530cc883cfb33712e392c96f174bbaa49 @majuscule majuscule committed Jan 27, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/DDG/Rewrite.pm
View
@@ -12,12 +12,12 @@ sub BUILD {
croak "Missing callback attribute for {{callback}} in to" if ($to =~ s/{{callback}}/$callback/g && !$self->has_callback);
my @missing_envs;
for ($to =~ m/{{ENV{(\w+)}}}/g) {
- if (defined $ENV{$1}) {
- my $val = $ENV{$1};
- $to =~ s/{{ENV{$1}}}/$val/g;
+ if (defined $ENV{$_}) {
+ my $val = $ENV{$_};
+ $to =~ s/{{ENV{$_}}}/$val/g;
} else {
- push @missing_envs, $1;
- $to =~ s/{{ENV{$1}}}//g;
+ push @missing_envs, $_;
+ $to =~ s/{{ENV{$_}}}//g;
}
}
$self->_missing_envs(\@missing_envs) if @missing_envs;

0 comments on commit 6c1c2aa

Please sign in to comment.