App-ptimeout
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
In scalar context, returns a hashref keyed by platform with the filename
of the most recent version of the supporting module that is available to you.
This behaviour is deprecated.
Unfortunately, on some platforms this list may have file case
broken. eg, some platforms might return '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 {
# sort by mtime, so oldest last. This was necessary so that if a module
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 0.392 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )