Alien-liburing
view release on metacpan or search on metacpan
inc/Devel/CheckOS.pm view on Meta::CPAN
If called on something that isn't a family, you get an empty list.
=cut
sub list_family_members {
my $family = shift() ||
die(__PACKAGE__."::list_family_members needs a parameter\n");
# this will die if it's the wrong OS, but the module is loaded ...
eval qq{use Devel::AssertOS::$family};
# ... so we can now query it
return eval qq{
no strict 'refs';
&{"Devel::AssertOS::${family}::matches"}()
};
}
=head3 register_alias
It takes two arguments, the first being an alias name, the second being the
name of an OS. After the alias has been registered, any queries about the
alias will return the appropriate result for the named OS.
It returns true unless you invoke it incorrectly or you attempt to change
an existing alias.
Aliases don't work under taint-mode.
See L<Devel::AssertOS::Extending>.
=cut
sub register_alias {
my($alias, $os) = @_;
($alias && $os) || return 0;
if(!exists($OS_ALIASES{$alias}) || $OS_ALIASES{$alias} eq $os) {
return $OS_ALIASES{$alias} = $os;
} else {
return 0
}
}
=head1 PLATFORMS SUPPORTED
To see the list of platforms for which information is available, run this:
perl -MDevel::CheckOS -e 'print join(", ", Devel::CheckOS::list_platforms())'
These are the names of the underlying Devel::AssertOS::* modules
which do the actual platform detection, so they have to
be 'legal' filenames and module names, which unfortunately precludes
funny characters, so platforms like OS/2 are mis-spelt deliberately.
Sorry.
Also be aware that not all of them have been properly tested. I don't
have access to most of them and have had to work from information
gleaned from L<perlport> and a few other places. For a complete list of
OS families, see L<Devel::CheckOS::Families>.
If you want to add your own OSes or families, see L<Devel::AssertOS::Extending>
and please feel free to upload the results to the CPAN.
=head1 BUGS and FEEDBACK
I welcome feedback about my code, including constructive criticism.
Bug reports should be made using L<https://github.com/DrHyde/perl-modules-Devel-CheckOS/issues>.
You will need to include in your bug report the exact value of $^O, what
the OS is called (eg Windows Vista 64 bit Ultimate Home Edition), and,
if relevant, what "OS family" it should be in and who wrote it.
If you are feeling particularly generous you can encourage me in my
open source endeavours by buying me something from my wishlist:
L<http://www.cantrell.org.uk/david/wishlist/>
=head1 COMPATIBILITY
Version 1.90 made all matches case-insensitive. This is a change in behaviour, but
if it breaks your code then your code was already broken, you just didn't know it.
As of version 2.00 the list_* functions always return plain old lists. Calling them
in scalar context was deprecated and has emitted warnings for over 2 years, since
version 1.90.
=head1 SEE ALSO
$^O in L<perlvar>
L<perlport>
L<Devel::AssertOS>
L<Devel::AssertOS::Extending>
L<Probe::Perl>
The use-devel-assertos script
L<Module::Install::AssertOS>
=head1 AUTHOR
David Cantrell E<lt>F<david@cantrell.org.uk>E<gt>
Thanks to David Golden for the name and ideas about the interface, and
to the cpan-testers-discuss mailing list for prompting me to write it
in the first place.
Thanks to Ken Williams, from whose L<Module::Build> I lifted some of the
information about what should be in the Unix family.
Thanks to Billy Abbott for finding some bugs for me on VMS.
Thanks to Matt Kraai for information about QNX.
Thanks to Kenichi Ishigaki and Gabor Szabo for reporting a bug on Windows,
and to the former for providing a patch.
Thanks to Paul Green for some information about VOS.
Thanks to Yanick Champoux for a patch to let Devel::AssertOS support
( run in 1.299 second using v1.01-cache-2.11-cpan-b16cb0d3907 )