Re: Darwin 8.6.0 (Mac OS X 10.4.6)
[email protected] (Dominic Dunlop) Mon, 15 May 2006 19:50:32 +0200
| Newsgroups | perl.daily-build |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail-2--242975746
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=WINDOWS-1252;
delsp=yes;
format=flowed
On 2006=9605=9614, at 02:59, Abe Timmerman wrote:
> Brill! I'll deal with that later on in the week.
OK. I've attached the patch for SysInfo.pm. I have not done anything =20
about the version, attribution or copyright.
--=20
Dominic Dunlop
--Apple-Mail-2--242975746
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="Test::Smoke::SysInfo.patch"
Content-Disposition: attachment;
filename="Test::Smoke::SysInfo.patch"
--- Test/Smoke/SysInfo.pm-as-received 2005-09-11 01:14:13.000000000 +0200
+++ Test/Smoke/SysInfo.pm 2006-05-15 15:22:33.000000000 +0200
@@ -55,7 +55,9 @@
$chk_os =~ /aix/i && return bless AIX(), $class;
- $chk_os =~ /darwin|bsd/i && return bless BSD(), $class;
+ $chk_os =~ /bsd/i && return bless BSD(), $class;
+
+ $chk_os =~ /darwin/i && return bless Darwin(), $class;
$chk_os =~ /hp-?ux/i && return bless HPUX(), $class;
@@ -345,6 +347,39 @@
};
}
+=head2 Darwin( )
+
+If the L<system_profiler> program is accessible (meaning that this is Mac OS X),
+use it to find information; otherwise treat as L</BSD>.
+
+=cut
+
+sub Darwin {
+ my $system_profiler_output;
+ {
+ no warnings 'exec'; # Just in case warnings are turned on ...
+ $system_profiler_output =
+ `/usr/sbin/system_profiler -detailLevel mini SPHardwareDataType`;
+ }
+ return BSD() unless $system_profiler_output;
+
+ my %system_profiler;
+ $system_profiler{$1} = $2
+ while $system_profiler_output =~ m/^\s*([\w ]+):\s+(.+)$/gm;
+
+ $system_profiler{'CPU Type'} =~ s/PowerPC\s*(\w+).*/ppc$1/;
+ $system_profiler{'CPU Speed'} =~
+ s/(\d+(?:\.\d+)?)\s*GHz/sprintf("%d MHz", $1 * 1000)/e;
+
+ return {
+ _cpu_type => $system_profiler{'CPU Type'} || __get_cpu_type(),
+ _cpu => "$system_profiler{'Machine Name'} ($system_profiler{'CPU Speed'})" || __get_cpu,
+ _ncpu => $system_profiler{'Number Of CPUs'},
+ _host => __get_hostname(),
+ _os => __get_os() . " (Mac OS X)",
+ };
+}
+
=head2 IRIX( )
Use the L<hinv> program to get the system information.
--Apple-Mail-2--242975746--