From ae6a824cb69c59244204d5472287a6eb8de8cd85 Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Thu, 20 Jul 2006 18:04:48 +0000 Subject: - clean code --- lib/MDV/Distribconf.pm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/MDV/Distribconf.pm b/lib/MDV/Distribconf.pm index 8a3c2fd..48818b0 100644 --- a/lib/MDV/Distribconf.pm +++ b/lib/MDV/Distribconf.pm @@ -243,7 +243,7 @@ sub check_mediacfg_version { # Otherwise the module can't properly handle it return 0 if (mymediacfg_version() < $wanted_version); - return 0 if ($wanted_version < $distrib->{cfg}->val('media_info', 'mediacfg_version', 1)); + return 0 if ($wanted_version < $distrib->getvalue(undef, 'mediacfg_version')); return 1 } @@ -393,17 +393,18 @@ sub getvalue { my $default = ""; for ($var) { - /^synthesis$/ and $default = 'synthesis.' . lc($distrib->getvalue($media, 'hdlist')); + /^synthesis$/ and $default = 'synthesis.' . lc($distrib->getvalue($media, 'hdlist')); /^hdlist$/ and $default = 'hdlist_' . lc($distrib->getvalue($media, 'name')) . '.cz'; /^pubkey$/ and $default = 'pubkey_' . lc($distrib->getvalue($media, 'name')); /^name$/ and $default = $media; $default =~ s![/ ]+!_!g; - /^path$/ and return $media; - /^root$/ and return $distrib->{root}; - /^VERSION$/ and do { $default = 'VERSION'; last }; - /^product$/ and do { $default = 'Download'; last }; - /^(?:tag|branch)$/ and do { $default = ''; last }; - /^(?:media|info)dir$/ and do { $default = $distrib->{$var}; last }; + /^path$/ and return $media; + /^root$/ and return $distrib->{root}; + /^mediacfg_version$/ and do { $default = '1'; last }; + /^VERSION$/ and do { $default = 'VERSION'; last }; + /^product$/ and do { $default = 'Download'; last }; + /^(?:tag|branch)$/ and do { $default = ''; last }; + /^(?:media|info)dir$/ and do { $default = $distrib->{$var}; last }; } return $distrib->{cfg}->val($media, $var, $default); } @@ -424,8 +425,10 @@ sub getpath { return ($distrib->getvalue(undef, 'mediacfg_version') >= 2 ? $distrib->{mediadir} : - ($val =~ m!/! ? "" : ($var eq 'path' ? $distrib->{mediadir} : $distrib->{infodir} ) . "/")) . - $val; + ($val =~ m!/! ? '' : + ($var eq 'path' ? $distrib->{mediadir} : $distrib->{infodir}) + ) + ) . '/' . $val; } =head2 $distrib->getfullpath($media, $var) -- cgit v1.2.1