Alien-liburing
view release on metacpan or search on metacpan
inc/Devel/CheckOS.pm view on Meta::CPAN
os_is os_isnt die_if_os_is die_if_os_isnt die_unsupported
list_platforms list_family_members register_alias
);
%EXPORT_TAGS = (
all => \@EXPORT_OK,
booleans => [qw(os_is os_isnt die_unsupported)],
fatal => [qw(die_if_os_is die_if_os_isnt)]
);
# get a list of the .pm files under a list of dirs, or the empty list
# in taint mode
sub _find_pm_files_in_dirs {
my @files;
eval { @files = File::Find::Rule->file()->name('*.pm')->in(@_) };
return @files;
}
if(exists($INC{'File/Find/Rule.pm'})) {
foreach my $alias_module (
_find_pm_files_in_dirs(
grep { -d }
inc/Devel/CheckOS.pm view on Meta::CPAN
TARGET: foreach my $target (@targets) {
# resolve aliases
ALIAS: foreach my $alias (keys %OS_ALIASES) {
if($target =~ /^$alias$/i) {
$target = $OS_ALIASES{$alias};
last ALIAS;
}
}
# resolve case-insensitive names (no-op in taint-mode as list_platforms
# won't work)
my @available_platforms = list_platforms();
CANDIDATE: foreach my $candidate (@available_platforms) {
if($target =~ /^\Q$candidate\E$/i) {
$target = $candidate;
last CANDIDATE;
}
}
die("Devel::CheckOS: $target isn't a legal OS name\n")
inc/Devel/CheckOS.pm view on Meta::CPAN
Return a list of all the platforms for which the corresponding
Devel::AssertOS::* module is available. This includes both OSes and OS
families, and both those bundled with this module and any third-party
add-ons you have installed.
Unfortunately, on some platforms this list may have platform names'
case broken, eg you might see 'freebsd' instead of 'FreeBSD'.
This is because they have case-insensitive filesystems so things
should Just Work anyway.
This function does not work in taint-mode.
=cut
my $case_flag = File::Spec->case_tolerant ? '(?i)' : '';
my $re_Devel = qr/$case_flag ^Devel$/x;
my $re_AssertOS = qr/$case_flag ^AssertOS$/x;
my $re_Alias = qr/$case_flag ^Alias\b/x;
sub list_platforms {
my @modules = sort keys %{ {map { $_ => 1 } grep {
inc/Devel/CheckOS.pm view on Meta::CPAN
=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;
( run in 1.402 second using v1.01-cache-2.11-cpan-e1769b4cff6 )