From be90c19f71062a1f1191ca9ad8558f843c0dadef Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 30 Nov 2004 10:47:43 +0000 Subject: (dmidecode) add (explicit) memoization --- perl-install/detect_devices.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'perl-install/detect_devices.pm') 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() { -- cgit v1.2.1