package Alien::Build::Plugin::Core::CleanInstall;
use strict;
use warnings;
use 5.008004;
use Alien::Build::Plugin;
use Path::Tiny ();
# ABSTRACT: Implementation for clean_install hook.
our $VERSION = '2.84'; # VERSION
sub init
{
my($self, $meta) = @_;
$meta->default_hook(
clean_install => sub {
my($build) = @_;
my $root = Path::Tiny->new(
$build->runtime_prop->{prefix}
);
if(-d $root)
{
foreach my $child ($root->children)
{
if($child->basename eq '_alien')
{
$build->log("keeping $child");
}
else
{
$build->log("removing $child");
$child->remove_tree({ safe => 0});
}
}
}
}
);
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Alien::Build::Plugin::Core::CleanInstall - Implementation for clean_install hook.
=head1 VERSION
version 2.84
=head1 SYNOPSIS
use alienfile;
# already loaded
=head1 DESCRIPTION
This plugin implements the default C