1Alien::Build::Plugin(3)User Contributed Perl DocumentatioAnlien::Build::Plugin(3)
2
3
4
6 Alien::Build::Plugin - Plugin base class for Alien::Build
7
9 version 2.17
10
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
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
79 new
80 my $plugin = Alien::Build::Plugin->new(%props);
81
83 init
84 $plugin->init($ab_class->meta); # $ab is an Alien::Build class name
85
86 You provide the implementation for this. The intent is to register
87 hooks and set meta properties on the Alien::Build class.
88
89 subplugin
90 DEPRECATED: Maybe removed, but not before 1 October 2018.
91
92 my $plugin2 = $plugin1->subplugin($plugin_name, %args);
93
94 Finds the given plugin and loads it (unless already loaded) and creats
95 a new instance and returns it. Most useful from a Negotiate plugin,
96 like this:
97
98 sub init
99 {
100 my($self, $meta) = @_;
101 $self->subplugin(
102 'Foo::Bar', # loads Alien::Build::Plugin::Foo::Bar,
103 # or throw exception
104 foo => 1, # these key/value pairs passsed into new
105 bar => 2, # for the plugin instance.
106 )->init($meta);
107 }
108
109 has
110 has $prop_name;
111 has $prop_name => $default;
112
113 Specifies a property of the plugin. You may provide a default value as
114 either a string scalar, or a code reference. The code reference will
115 be called to compute the default value, and if you want the default to
116 be a list or hash reference, this is how you want to do it:
117
118 has foo => sub { [1,2,3] };
119
120 meta
121 my $meta = $plugin->meta;
122
123 Returns the plugin meta object.
124
126 Alien::Build, alienfile, Alien::Build::Manual::PluginAuthor
127
129 Author: Graham Ollis <plicease@cpan.org>
130
131 Contributors:
132
133 Diab Jerius (DJERIUS)
134
135 Roy Storey (KIWIROY)
136
137 Ilya Pavlov
138
139 David Mertens (run4flat)
140
141 Mark Nunberg (mordy, mnunberg)
142
143 Christian Walde (Mithaldu)
144
145 Brian Wightman (MidLifeXis)
146
147 Zaki Mughal (zmughal)
148
149 mohawk (mohawk2, ETJ)
150
151 Vikas N Kumar (vikasnkumar)
152
153 Flavio Poletti (polettix)
154
155 Salvador Fandiño (salva)
156
157 Gianni Ceccarelli (dakkar)
158
159 Pavel Shaydo (zwon, trinitum)
160
161 Kang-min Liu (劉康民, gugod)
162
163 Nicholas Shipp (nshp)
164
165 Juan Julián Merelo Guervós (JJ)
166
167 Joel Berger (JBERGER)
168
169 Petr Pisar (ppisar)
170
171 Lance Wicks (LANCEW)
172
173 Ahmad Fatoum (a3f, ATHREEF)
174
175 José Joaquín Atria (JJATRIA)
176
177 Duke Leto (LETO)
178
179 Shoichi Kaji (SKAJI)
180
181 Shawn Laffan (SLAFFAN)
182
183 Paul Evans (leonerd, PEVANS)
184
186 This software is copyright (c) 2011-2020 by Graham Ollis.
187
188 This is free software; you can redistribute it and/or modify it under
189 the same terms as the Perl 5 programming language system itself.
190
191
192
193perl v5.30.2 2020-03-20 Alien::Build::Plugin(3)