Build.PL
branchModule::Build
changeset 17 bd500305861e
parent 16 9501cc7d9177
child 18 6ebc687219db
--- a/Build.PL	Fri Mar 27 11:03:05 2015 +0100
+++ b/Build.PL	Wed Apr 01 11:19:29 2015 +0200
@@ -3,17 +3,66 @@
 use strict;
 use warnings;
 
+# b0rken umlauts in MYMETA.* files otherwise
+use utf8;
+
 use Module::Build;
 
-my $build = Module::Build->new
+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
 (
     dist_name => 'nagios-plugin-cert',
     dist_author => 'Matthias Förste',
-    dist_version_from => 'lib/nagios/plugins/ius/check_cert',
+    dist_version_from => 'check_cert.pl',
     requires => {
         'Nagios::Plugin' => 0,
         'Crypt::OpenSSL::PKCS12' => 0,
         'Crypt::OpenSSL::X509' => 0
     },
+    extra_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->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);