Alien-Build
view release on metacpan or search on metacpan
lib/Alien/Build/Util.pm view on Meta::CPAN
$src = $src->absolute($src_root);
if(-l "$src")
{
unless(-d $dst->parent)
{
Alien::Build->log("mkdir -p @{[ $dst->parent ]}") if $opt->{verbose};
$dst->parent->mkpath;
}
# TODO: rmtree if a directory?
if(-e "$dst")
{ unlink "$dst" }
my $target = readlink "$src";
Alien::Build->log("ln -s $target $dst") if $opt->{verbose};
symlink($target, $dst) || die "unable to symlink $target => $dst";
}
elsif(-d "$src")
{
if($opt->{empty_directory})
{
unless(-d $dst)
{
Alien::Build->log("mkdir $dst") if $opt->{verbose};
mkdir($dst) || die "unable to create directory $dst: $!";
}
}
}
elsif(-f "$src")
{
unless(-d $dst->parent)
{
Alien::Build->log("mkdir -p @{[ $dst->parent ]}") if $opt->{verbose};
$dst->parent->mkpath;
}
# TODO: rmtree if a directory?
if(-e "$dst")
{ unlink "$dst" }
Alien::Build->log("cp $src $dst") if $opt->{verbose};
File::Copy::cp("$src", "$dst") || die "copy error $src => $dst: $!";
if($] < 5.012 && -x "$src" && $^O ne 'MSWin32')
{
# apparently Perl 5.8 and 5.10 do not preserver perms
my $mode = [stat "$src"]->[2] & oct(777);
eval { chmod $mode, "$dst" };
}
}
},
no_chdir => 1,
}, "$src_root");
();
}
sub _dump
{
if(eval { require YAML })
{
return YAML::Dump(@_);
}
else
{
require Data::Dumper;
return Data::Dumper::Dumper(@_);
}
}
sub _destdir_prefix
{
my($destdir, $prefix) = @_;
$prefix =~ s{^/?([a-z]):}{$1}i if $^O eq 'MSWin32';
path($destdir)->child($prefix)->stringify;
}
sub _perl_config
{
my($key) = @_;
$Config{$key};
}
sub _ssl_reqs
{
return {
'Net::SSLeay' => '1.49',
'IO::Socket::SSL' => '1.56',
};
}
sub _has_ssl
{
my %reqs = %{ _ssl_reqs() };
eval {
require Net::SSLeay;
die "need Net::SSLeay $reqs{'Net::SSLeay'}" unless Net::SSLeay->VERSION($reqs{'Net::SSLeay'});
require IO::Socket::SSL;
die "need IO::Socket::SSL $reqs{'IO::Socket::SSL'}" unless IO::Socket::SSL->VERSION($reqs{'IO::Socket::SSL'});
};
$@ eq '';
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Alien::Build::Util - Private utility functions for Alien::Build
=head1 VERSION
version 2.84
=head1 DESCRIPTION
This module contains some private utility functions used internally by
L<Alien::Build>. It shouldn't be used by any distribution other than
C<Alien-Build>. That includes L<Alien::Build> plugins that are not
part of the L<Alien::Build> core.
You have been warned. The functionality within may be removed at
( run in 1.943 second using v1.01-cache-2.11-cpan-ecdf5575e8d )