The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Alien::Build::Plugin - Plugin base class for Alien::Build

VERSION

version 0.04

SYNOPSIS

Create your plugin:

 package Alien::Build::Plugin::Type::MyPlugin;
 
 use Alien::Build::Plugin;
 use Carp ();
 
 has prop1 => 'default value';
 has prop2 => sub { 'default value' };
 has prop3 => sub { Carp::croak 'prop3 is a required property' };
 
 sub init
 {
   my($self, $meta) = @_;
   
   $meta->register_hook(sub {
     build => [ '%{make}', '%{make} install' ],
   });
 }

From your alienfile

 use alienfile;
 plugin 'Type::MyPlugin' => (
   prop2 => 'different value',
   prop3 => 'need to provide since it is required',
 );

DESCRIPTION

This document describes the Alien::Build plugin base class. For details on how to write a plugin, see Alien::Build::Manual::PluginAuthor.

CONSTRUCTOR

new

 my $plugin = Alien::Build::Plugin->new(%props);

METHODS

init

 $plugin->init($ab_class->meta); # $ab is an Alien::Build class name

You provide the implementation for this. The intent is to register hooks and set meta properties on the Alien::Build class.

has

 has $prop_name;
 has $prop_name => $default;

Specifies a property of the plugin. You may provide a default value as either a string scalar, or a code reference. The code reference will be called to compute the default value, and if you want the default to be a list or hash reference, this is how you want to do it:

 has foo => sub { [1,2,3] };

meta

 my $meta = $plugin->meta;

Returns the plugin meta object.

SEE ALSO

Alien::Build, alienfile, Alien::Build::Manual::PluginAuthor

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.