summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-12-13 09:54:08 +0000
committerThierry Vignaud <tv@mageia.org>2012-12-13 09:54:08 +0000
commit4a8e726b2a297aa91642afb2abd60844a8b63bff (patch)
tree24e856d5b6a8847bbffb4915bb13582f7669e2ba /urpm
parent2a8d84983d7823de9cf0312fec55568c3a9a96f4 (diff)
downloadurpmi-4a8e726b2a297aa91642afb2abd60844a8b63bff.tar
urpmi-4a8e726b2a297aa91642afb2abd60844a8b63bff.tar.gz
urpmi-4a8e726b2a297aa91642afb2abd60844a8b63bff.tar.bz2
urpmi-4a8e726b2a297aa91642afb2abd60844a8b63bff.tar.xz
urpmi-4a8e726b2a297aa91642afb2abd60844a8b63bff.zip
(write_ldap_cache) simplify using output_safe()
Diffstat (limited to 'urpm')
-rw-r--r--urpm/ldap.pm14
1 files changed, 6 insertions, 8 deletions
diff --git a/urpm/ldap.pm b/urpm/ldap.pm
index 5c5edbb3..281ad56c 100644
--- a/urpm/ldap.pm
+++ b/urpm/ldap.pm
@@ -40,14 +40,12 @@ sub write_ldap_cache($$) {
# FIXME what perm for cache ?
-d $ldap_cache or mkdir $ldap_cache
or die N("Cannot create ldap cache directory");
- open my $cache, ">", "$ldap_cache/$medium->{name}"
- or die N("Cannot write cache file for ldap\n");
- print $cache "# internal cache file for disconnect ldap operation, do not edit\n";
- foreach (keys %$medium) {
- defined $medium->{$_} or next;
- print $cache "$_ = $medium->{$_}\n";
- }
- close $cache;
+ output_safe("$ldap_cache/$medium->{name}",
+ join("\n",
+ "# internal cache file for disconnect ldap operation, do not edit",
+ map { "$_ = $medium->{$_}" } grep { $medium->{$_} } keys %$medium
+ )
+ ) or die N("Cannot write cache file for ldap\n");
return 1;
}