initial Build.PL & builder class (overrides install action to fix installation paths for nagios plugins)
--- a/Build.PL Wed Apr 01 11:19:29 2015 +0200
+++ b/Build.PL Thu Apr 02 16:10:49 2015 +0200
@@ -6,38 +6,9 @@
# b0rken umlauts in MYMETA.* files otherwise
use utf8;
-use Module::Build;
-
-my $class = Module::Build->subclass
-(
- class => 'My::Builder',
- relpath => { nagiosplugins => 'lib/nagios/plugins/ius' },
- code => q{
- sub ACTION_install {
- my $self = shift;
- my $relpath;
- $relpath->{nagiosplugins} = 'lib/nagios/plugins/ius';
-# for (qw(nagiosplugins)) {
-# $self->install_base_relpaths($_, $relpath->{$_});
-# $self->prefix_base_relpaths($_, $relpath->{$_});
-# }
- use Data::Dumper;
- print Dumper($self);
- print Dumper($self->install_base_relpaths());
- print Dumper($self->prefix_relpaths());
- print Dumper($self->installdirs());
- print Dumper($self->install_path());
- print Dumper($self->install_base());
- print Dumper($self->install_destination('nagiosplugins'));
- print Dumper($self->install_types());
- $self->SUPER::ACTION_install;
- }
- },
-);
-
-#my $build = Module::Build->new
-my $build = $class->new
-(
+use lib '.';
+use My::Builder;
+my $build = My::Builder->new(
dist_name => 'nagios-plugin-cert',
dist_author => 'Matthias Förste',
dist_version_from => 'check_cert.pl',
@@ -46,23 +17,10 @@
'Crypt::OpenSSL::PKCS12' => 0,
'Crypt::OpenSSL::X509' => 0
},
- extra_files => {
+ check_files => {
'check_cert.pl' => 'nagiosplugins/check_cert'
}
);
-$build->add_build_element('extra');
-for my $e (qw(nagiosplugins)) {
- # these seem to be used only when --install-base or --prefix is explicitly given; if only --installdirs or nothing at all is given we probably need to set install_path
- $build->install_base_relpaths($e => $build->{relpath}->{$e});
- $build->prefix_relpaths($_, $e => $build->{relpath}->{$e}) for (qw(site core vendor));
-}
-#$build->install_path(nagiosplugin => Module::Build::install_base() . 'lib/nagios/plugins/ius');
+$build->add_build_element('check');
$build->create_build_script;
-use Data::Dumper;
-#print Dumper($build->install_base_relpaths());
-#print Dumper($build->prefix_relpaths());
-#print Dumper($build->installdirs());
-#print Dumper($build->install_path());
-#print Dumper($build->install_base());
-print Dumper($build);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/My/Builder.pm Thu Apr 02 16:10:49 2015 +0200
@@ -0,0 +1,20 @@
+use strict;
+use warnings;
+
+package My::Builder;
+use Module::Build;
+our @ISA = qw(Module::Build);
+
+sub ACTION_install {
+
+ my $self = shift;
+ my $prefix = $self->install_base()
+ // $self->prefix()
+ // $self->config( { site => 'siteprefix', vendor => 'vendorprefix', core => 'prefix' }->{$self->installdirs()} )
+ // die 'this should not happen';
+
+ $self->install_path('nagiosplugins', "$prefix/lib/nagios/plugins/ius");
+ $self->SUPER::ACTION_install;
+
+}
+1;