Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
cast keys to hash references for stricter perls
Browse files Browse the repository at this point in the history
  • Loading branch information
majuscule committed Jan 30, 2013
1 parent 5025afe commit 6632a05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/App/DuckPAN.pm
Expand Up @@ -288,7 +288,7 @@ sub BUILD {
my $env_config = file($self->cfg->config_path, 'env.ini');
if (-e $env_config) {
my $env = Config::INI::Reader->read_file(file($self->cfg->config_path, 'env.ini'));
map { $ENV{$_} = $env->{'_'}{$_}; } keys $env->{'_'} if $env->{'_'};
map { $ENV{$_} = $env->{'_'}{$_}; } keys %{$env->{'_'}} if $env->{'_'};
}
}

Expand Down
8 changes: 4 additions & 4 deletions lib/App/DuckPAN/Cmd/Env.pm
Expand Up @@ -18,17 +18,17 @@ sub run {
if (defined $name ) {
my $config = Config::INI::Reader->read_file($config_file);
if ($name eq 'key') {
map { print "$_ = $config->{'_'}{$_}\n" } keys $config->{'_'};
map { print "$_ = $config->{'_'}{$_}\n" } keys %{$config->{'_'}};
exit 0;
} elsif ($name eq 'rm') {
if ($config->{'_'} and grep {$_ eq $key} keys $config->{'_'}) {
if ($config->{'_'} and grep {$_ eq $key} keys %{$config->{'_'}}) {
delete $config->{'_'}{$key};
open my $output, '>', $config_file;
Config::INI::Writer->write_handle($config, $output);
Config::INI::Writer->write_handle(%{$config}, $output);
exit 0;
}
exit 0 if defined $key;
} elsif ($config->{'_'} and grep {$_ eq $name} keys $config->{'_'}) {
} elsif ($config->{'_'} and grep {$_ eq $name} keys %{$config->{'_'}}) {
print STDERR "$name is already defined in env.ini\n";
exit 1;
}
Expand Down

0 comments on commit 6632a05

Please sign in to comment.