1Alien::Build::Plugin(3)User Contributed Perl DocumentatioAnlien::Build::Plugin(3)
2
3
4

NAME

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

VERSION

9       version 2.40
10

SYNOPSIS

12       Create your plugin:
13
14        package Alien::Build::Plugin::Type::MyPlugin;
15
16        use Alien::Build::Plugin;
17        use Carp ();
18
19        has prop1 => 'default value';
20        has prop2 => sub { 'default value' };
21        has prop3 => sub { Carp::croak 'prop3 is a required property' };
22
23        sub init
24        {
25          my($self, $meta) = @_;
26
27          my $prop1 = $self->prop1;
28          my $prop2 = $self->prop2;
29          my $prop3 = $self->prop3;
30
31          $meta->register_hook(sub {
32            build => [ '%{make}', '%{make} install' ],
33          });
34        }
35
36       From your alienfile
37
38        use alienfile;
39        plugin 'Type::MyPlugin' => (
40          prop2 => 'different value',
41          prop3 => 'need to provide since it is required',
42        );
43

DESCRIPTION

45       This document describes the Alien::Build plugin base class.  For
46       details on how to write a plugin, see
47       Alien::Build::Manual::PluginAuthor.
48
49       Listed are some common types of plugins:
50
51       Alien::Build::Plugin::Build
52           Tools for building.
53
54       Alien::Build::Plugin::Core
55           Tools already included.
56
57       Alien::Build::Plugin::Download
58           Methods for retrieving from the internet.
59
60       Alien::Build::Plugin::Decode
61           Normally use Download plugins which will pick the correct Decode
62           plugins.
63
64       Alien::Build::Plugin::Extract
65           Extract from archives that have been downloaded.
66
67       Alien::Build::Plugin::Fetch
68           Normally use Download plugins which will pick the correct Fetch
69           plugins.
70
71       Alien::Build::Plugin::Prefer
72           Normally use Download plugins which will pick the correct Prefer
73           plugins.
74
75       Alien::Build::Plugin::Probe
76           Look for packages already installed on the system.
77

CONSTRUCTOR

79   new
80        my $plugin = Alien::Build::Plugin->new(%props);
81
82   PROPERTIES
83   instance_id
84        my $id = $plugin->instance_id;
85
86       Returns an instance id for the plugin.  This is computed from the class
87       and arguments that are passed into the plugin constructor, so
88       technically two instances with the exact same arguments will have the
89       same instance id, but in practice you should never have two instances
90       with the exact same arguments.
91

METHODS

93   init
94        $plugin->init($ab_class->meta); # $ab is an Alien::Build class name
95
96       You provide the implementation for this.  The intent is to register
97       hooks and set meta properties on the Alien::Build class.
98
99   subplugin
100       DEPRECATED: Maybe removed, but not before 1 October 2018.
101
102        my $plugin2 = $plugin1->subplugin($plugin_name, %args);
103
104       Finds the given plugin and loads it (unless already loaded) and creats
105       a new instance and returns it.  Most useful from a Negotiate plugin,
106       like this:
107
108        sub init
109        {
110          my($self, $meta) = @_;
111          $self->subplugin(
112            'Foo::Bar',  # loads Alien::Build::Plugin::Foo::Bar,
113                         # or throw exception
114            foo => 1,    # these key/value pairs passsed into new
115            bar => 2,    # for the plugin instance.
116          )->init($meta);
117        }
118
119   has
120        has $prop_name;
121        has $prop_name => $default;
122
123       Specifies a property of the plugin.  You may provide a default value as
124       either a string scalar, or a code reference.  The code reference will
125       be called to compute the default value, and if you want the default to
126       be a list or hash reference, this is how you want to do it:
127
128        has foo => sub { [1,2,3] };
129
130   meta
131        my $meta = $plugin->meta;
132
133       Returns the plugin meta object.
134

SEE ALSO

136       Alien::Build, alienfile, Alien::Build::Manual::PluginAuthor
137

AUTHOR

139       Author: Graham Ollis <plicease@cpan.org>
140
141       Contributors:
142
143       Diab Jerius (DJERIUS)
144
145       Roy Storey (KIWIROY)
146
147       Ilya Pavlov
148
149       David Mertens (run4flat)
150
151       Mark Nunberg (mordy, mnunberg)
152
153       Christian Walde (Mithaldu)
154
155       Brian Wightman (MidLifeXis)
156
157       Zaki Mughal (zmughal)
158
159       mohawk (mohawk2, ETJ)
160
161       Vikas N Kumar (vikasnkumar)
162
163       Flavio Poletti (polettix)
164
165       Salvador Fandiño (salva)
166
167       Gianni Ceccarelli (dakkar)
168
169       Pavel Shaydo (zwon, trinitum)
170
171       Kang-min Liu (劉康民, gugod)
172
173       Nicholas Shipp (nshp)
174
175       Juan Julián Merelo Guervós (JJ)
176
177       Joel Berger (JBERGER)
178
179       Petr Pisar (ppisar)
180
181       Lance Wicks (LANCEW)
182
183       Ahmad Fatoum (a3f, ATHREEF)
184
185       José Joaquín Atria (JJATRIA)
186
187       Duke Leto (LETO)
188
189       Shoichi Kaji (SKAJI)
190
191       Shawn Laffan (SLAFFAN)
192
193       Paul Evans (leonerd, PEVANS)
194
195       Håkon Hægland (hakonhagland, HAKONH)
196
198       This software is copyright (c) 2011-2020 by Graham Ollis.
199
200       This is free software; you can redistribute it and/or modify it under
201       the same terms as the Perl 5 programming language system itself.
202
203
204
205perl v5.32.1                      2021-05-13           Alien::Build::Plugin(3)
Impressum