diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2002-08-05 15:20:12 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2002-08-05 15:20:12 +0000 |
commit | eab7c4563e689dfd450b7d2c4e5ea1966c5b960c (patch) | |
tree | 23aa38ccb7a9fb4dabb90023781d851b7cb5fcc5 /perl-install/modparm.pm | |
parent | 7b2fc2637d30c36d50e0c6a4006c3bf6d594c1cd (diff) | |
download | drakx-backup-do-not-use-eab7c4563e689dfd450b7d2c4e5ea1966c5b960c.tar drakx-backup-do-not-use-eab7c4563e689dfd450b7d2c4e5ea1966c5b960c.tar.gz drakx-backup-do-not-use-eab7c4563e689dfd450b7d2c4e5ea1966c5b960c.tar.bz2 drakx-backup-do-not-use-eab7c4563e689dfd450b7d2c4e5ea1966c5b960c.tar.xz drakx-backup-do-not-use-eab7c4563e689dfd450b7d2c4e5ea1966c5b960c.zip |
factorize some code in modparm::parameter_type
Diffstat (limited to 'perl-install/modparm.pm')
-rw-r--r-- | perl-install/modparm.pm | 25 |
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; } |