David Golden
Wed, 26 Sep 2007 08:27:23 -0700
On 9/26/07, David Cantrell <[EMAIL PROTECTED]> wrote: > > If the latter could be a 'canonical' way to map $^O to OS "families" > > that would be great. I see the same cut and paste code for that in > > numerous modules. > > Oh good, where should I cut n paste it from for version 1? :-)
How about Module::Build and the %OSTYPES hash?
> > For CheckOS -- you might want to consider whether you want positive or
> > negative assertions or both. (Plus families)
>
> Definitely. How about this for an interface ...
>
> os_is('Unix')
> os_is('AIX')
> os_is_not('Windows')
> os_is('WinXP', 'WinVista') # match either of these
> etc
I like this -- the flexibility of being able to query multiple names
is very nice.
os_is("Win32")
os_is("Windows")
> and to make them fatal instead of returning false, ...
>
> use Devel::CheckOS 'fatalfailures';
I don't like this. If there's import magic, I prefer that it only
exist for modules that aren't also doing subroutine imports as well.
> use Devel::CheckOS::Unix; # and die with a suitable message if not
I'd prefer Devel::AssertOS::Unix. Leave Devel::CheckOS for the
functions, and then include in the same distro the simple "assert on
use" modules.
You'll still need to provide the "die with message" function for CheckOS.
use Devel::CheckOS;
os_is("Windows", "Cygwin") or die_os_unsupported();
David