summaryrefslogtreecommitdiffstats
path: root/perl-install/modparm.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-08-05 15:20:12 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-08-05 15:20:12 +0000
commiteab7c4563e689dfd450b7d2c4e5ea1966c5b960c (patch)
tree23aa38ccb7a9fb4dabb90023781d851b7cb5fcc5 /perl-install/modparm.pm
parent7b2fc2637d30c36d50e0c6a4006c3bf6d594c1cd (diff)
downloaddrakx-eab7c4563e689dfd450b7d2c4e5ea1966c5b960c.tar
drakx-eab7c4563e689dfd450b7d2c4e5ea1966c5b960c.tar.gz
drakx-eab7c4563e689dfd450b7d2c4e5ea1966c5b960c.tar.bz2
drakx-eab7c4563e689dfd450b7d2c4e5ea1966c5b960c.tar.xz
drakx-eab7c4563e689dfd450b7d2c4e5ea1966c5b960c.zip
factorize some code in modparm::parameter_type
Diffstat (limited to 'perl-install/modparm.pm')
-rw-r--r--perl-install/modparm.pm25
1 files changed, 14 insertions, 11 deletions
diff --git a/perl-install/modparm.pm b/perl-install/modparm.pm
index baeab41f8..f31a0178e 100644
--- a/perl-install/modparm.pm
+++ b/perl-install/modparm.pm
@@ -9,6 +9,17 @@ use strict;
use common;
use modules;
+sub parameter_type {
+ my ($min, $max, $is_a_number) = @_;
+ $min == 1 && $max == 1 ?
+ ($is_a_number ? _("a number") : '') :
+ $min == $max ?
+ ($is_a_number ? _("%d comma separated numbers", $min) : _("%d comma separated strings", $min)) :
+ $min == 1 ?
+ ($is_a_number ? _("comma separated numbers") : _("comma separated strings")) :
+ ''; #- to weird and buggy, do not display it
+}
+
sub raw_parameters {
my ($module) = @_;
@@ -55,17 +66,9 @@ sub parameters {
my ($module) = @_;
my @parameters ;
foreach (raw_parameters($module)) {
- my ($name, $format_, $description, $min, $max, $is_a_number) = @$_;
- my $format =
- $min == 1 && $max == 1 ?
- ($is_a_number ? _("a number") : '') :
- $min == $max ?
- ($is_a_number ? _("%d comma separated numbers", $min) : _("%d comma separated strings", $min)) :
- $min == 1 ?
- ($is_a_number ? _("comma separated numbers") : _("comma separated strings")) :
- ''; #- to weird and buggy, do not display it
-
- push @parameters, [ $format ? "$name ($format)" : $name, $description ];
+ my ($name, undef, $description, $min, $max, $is_a_number) = @$_;
+ my $format = parameter_type($min, $max, $is_a_number);
+ push @parameters, [ $format ? "$name ($format)" : $name, $description ];
}
@parameters;
}