While this is cleaner and better than having tons of separate modules it's not really that helpfull. I mean, most usualy you do not want to blow up if you detect a certain OS. You merely want to load a bit different modules, implement something a little different, set a variable accordingly ...
So IMHO we'de need somethig less "cool". Maybe something like
use SysInfo qw(RunUnder);
if (RunUnder 'Win32') {
if (RunUnder 'Win2000+') {
print "Running under Win2000 or WinXP\n";
} else {
print "Running under some older or more stripped down Windows\n";
} elsif (RunUnder 'Unix') {
if (RunUnder 'BSD') {
print "Runnind under BDS Unix\n";
} else {
print "Running under some other Unix\n"
}
} else {
print "GOK what are you using\n";
}
It would be cool if perl could optimize out the code that will not be used when compiling the code, but I don't think that matters much. You do not test for the OS you are running under in tight loops.
Jenda@Krynicky.cz |