Alien::Build::Plugin - Plugin base class for Alien::Build
version 2.84
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) = @_; my $prop1 = $self->prop1; my $prop2 = $self->prop2; my $prop3 = $self->prop3; $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', );
This document describes the Alien::Build plugin base class. For details on how to write a plugin, see Alien::Build::Manual::PluginAuthor.
Listed are some common types of plugins:
Tools for building.
Tools already included.
Normally use Download plugins which will pick the correct Decode plugins.
Tools for checking cryptographic signatures during a share
install.
Methods for retrieving from the internet.
Extract from archives that have been downloaded.
Normally use Download plugins which will pick the correct Fetch plugins.
Plugins that modify or enhance the gather step.
Plugins that work with pkg-config
or libraries that provide the same functionality.
Normally use Download plugins which will pick the correct Prefer plugins.
Look for packages already installed on the system.
Plugins useful for unit testing Alien::Build itself, or plugins for it.
my $plugin = Alien::Build::Plugin->new(%props);
my $id = $plugin->instance_id;
Returns an instance id for the plugin. This is computed from the class and arguments that are passed into the plugin constructor, so technically two instances with the exact same arguments will have the same instance id, but in practice you should never have two instances with the exact same arguments.
$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 $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] };
my $meta = $plugin->meta;
Returns the plugin meta object.
Alien::Build, alienfile, Alien::Build::Manual::PluginAuthor
Author: Graham Ollis <plicease@cpan.org>
Contributors:
Diab Jerius (DJERIUS)
Roy Storey (KIWIROY)
Ilya Pavlov
David Mertens (run4flat)
Mark Nunberg (mordy, mnunberg)
Christian Walde (Mithaldu)
Brian Wightman (MidLifeXis)
Zaki Mughal (zmughal)
mohawk (mohawk2, ETJ)
Vikas N Kumar (vikasnkumar)
Flavio Poletti (polettix)
Salvador Fandiño (salva)
Gianni Ceccarelli (dakkar)
Pavel Shaydo (zwon, trinitum)
Kang-min Liu (劉康民, gugod)
Nicholas Shipp (nshp)
Juan Julián Merelo Guervós (JJ)
Joel Berger (JBERGER)
Petr Písař (ppisar)
Lance Wicks (LANCEW)
Ahmad Fatoum (a3f, ATHREEF)
José Joaquín Atria (JJATRIA)
Duke Leto (LETO)
Shoichi Kaji (SKAJI)
Shawn Laffan (SLAFFAN)
Paul Evans (leonerd, PEVANS)
Håkon Hægland (hakonhagland, HAKONH)
nick nauwelaerts (INPHOBIA)
Florian Weimer
This software is copyright (c) 2011-2022 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.