summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-11-30 10:47:43 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-11-30 10:47:43 +0000
commitbe90c19f71062a1f1191ca9ad8558f843c0dadef (patch)
tree38c285f09e36520cc39fb9e04032b89922063a54
parentd2afb181655c6c89f17fd7dc184a6dc790bfc099 (diff)
downloaddrakx-backup-do-not-use-be90c19f71062a1f1191ca9ad8558f843c0dadef.tar
drakx-backup-do-not-use-be90c19f71062a1f1191ca9ad8558f843c0dadef.tar.gz
drakx-backup-do-not-use-be90c19f71062a1f1191ca9ad8558f843c0dadef.tar.bz2
drakx-backup-do-not-use-be90c19f71062a1f1191ca9ad8558f843c0dadef.tar.xz
drakx-backup-do-not-use-be90c19f71062a1f1191ca9ad8558f843c0dadef.zip
(dmidecode) add (explicit) memoization
-rw-r--r--perl-install/detect_devices.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index bbc2186f0..483d7d44c 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -772,20 +772,22 @@ sub hasSMP() {
}
sub hasPCMCIA() { $::o->{pcmcia} } #- because /proc/pcmcia seems not to be present on 2.4 at least (or use /var/run/stab)
+my @dmis;
+
sub dmidecode() {
- my @l;
+ return @dmis if @dmis;
foreach (run_program::get_stdout('dmidecode')) {
if (/^\t\t(.*)/) {
- $l[-1]{string} .= "$1\n";
- $l[-1]{$1} = $2 if /^\t\t(.*): (.*)$/;
+ $dmis[-1]{string} .= "$1\n";
+ $dmis[-1]{$1} = $2 if /^\t\t(.*): (.*)$/;
} elsif (my ($s) = /^\t(.*)/) {
next if $s =~ /^DMI type /;
$s =~ s/ Information$//;
- push @l, { name => $s };
+ push @dmis, { name => $s };
}
}
- @l;
+ @dmis;
}
sub computer_info() {