JezK
Edit File: Alien::Build::Plugin.3pm
.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Alien::Build::Plugin 3pm" .TH Alien::Build::Plugin 3pm "2020-01-27" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Alien::Build::Plugin \- Plugin base class for Alien::Build .SH "VERSION" .IX Header "VERSION" version 1.96 .SH "SYNOPSIS" .IX Header "SYNOPSIS" Create your plugin: .PP .Vb 1 \& package Alien::Build::Plugin::Type::MyPlugin; \& \& use Alien::Build::Plugin; \& use Carp (); \& \& has prop1 => \*(Aqdefault value\*(Aq; \& has prop2 => sub { \*(Aqdefault value\*(Aq }; \& has prop3 => sub { Carp::croak \*(Aqprop3 is a required property\*(Aq }; \& \& sub init \& { \& my($self, $meta) = @_; \& \& my $prop1 = $self\->prop1; \& my $prop2 = $self\->prop2; \& my $prop3 = $self\->prop3; \& \& $meta\->register_hook(sub { \& build => [ \*(Aq%{make}\*(Aq, \*(Aq%{make} install\*(Aq ], \& }); \& } .Ve .PP From your alienfile .PP .Vb 5 \& use alienfile; \& plugin \*(AqType::MyPlugin\*(Aq => ( \& prop2 => \*(Aqdifferent value\*(Aq, \& prop3 => \*(Aqneed to provide since it is required\*(Aq, \& ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This document describes the Alien::Build plugin base class. For details on how to write a plugin, see Alien::Build::Manual::PluginAuthor. .PP Listed are some common types of plugins: .IP "Alien::Build::Plugin::Build" 4 .IX Item "Alien::Build::Plugin::Build" Tools for building. .IP "Alien::Build::Plugin::Core" 4 .IX Item "Alien::Build::Plugin::Core" Tools already included. .IP "Alien::Build::Plugin::Download" 4 .IX Item "Alien::Build::Plugin::Download" Methods for retrieving from the internet. .IP "Alien::Build::Plugin::Decode" 4 .IX Item "Alien::Build::Plugin::Decode" Normally use Download plugins which will pick the correct Decode plugins. .IP "Alien::Build::Plugin::Extract" 4 .IX Item "Alien::Build::Plugin::Extract" Extract from archives that have been downloaded. .IP "Alien::Build::Plugin::Fetch" 4 .IX Item "Alien::Build::Plugin::Fetch" Normally use Download plugins which will pick the correct Fetch plugins. .IP "Alien::Build::Plugin::Prefer" 4 .IX Item "Alien::Build::Plugin::Prefer" Normally use Download plugins which will pick the correct Prefer plugins. .IP "Alien::Build::Plugin::Probe" 4 .IX Item "Alien::Build::Plugin::Probe" Look for packages already installed on the system. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .SS "new" .IX Subsection "new" .Vb 1 \& my $plugin = Alien::Build::Plugin\->new(%props); .Ve .SH "METHODS" .IX Header "METHODS" .SS "init" .IX Subsection "init" .Vb 1 \& $plugin\->init($ab_class\->meta); # $ab is an Alien::Build class name .Ve .PP You provide the implementation for this. The intent is to register hooks and set meta properties on the Alien::Build class. .SS "subplugin" .IX Subsection "subplugin" \&\fB\s-1DEPRECATED\s0\fR: Maybe removed, but not before 1 October 2018. .PP .Vb 1 \& my $plugin2 = $plugin1\->subplugin($plugin_name, %args); .Ve .PP Finds the given plugin and loads it (unless already loaded) and creats a new instance and returns it. Most useful from a Negotiate plugin, like this: .PP .Vb 10 \& sub init \& { \& my($self, $meta) = @_; \& $self\->subplugin( \& \*(AqFoo::Bar\*(Aq, # loads Alien::Build::Plugin::Foo::Bar, \& # or throw exception \& foo => 1, # these key/value pairs passsed into new \& bar => 2, # for the plugin instance. \& )\->init($meta); \& } .Ve .SS "has" .IX Subsection "has" .Vb 2 \& has $prop_name; \& has $prop_name => $default; .Ve .PP 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: .PP .Vb 1 \& has foo => sub { [1,2,3] }; .Ve .SS "meta" .IX Subsection "meta" .Vb 1 \& my $meta = $plugin\->meta; .Ve .PP Returns the plugin meta object. .SH "SEE ALSO" .IX Header "SEE ALSO" Alien::Build, alienfile, Alien::Build::Manual::PluginAuthor .SH "AUTHOR" .IX Header "AUTHOR" Author: Graham Ollis <plicease@cpan.org> .PP Contributors: .PP Diab Jerius (\s-1DJERIUS\s0) .PP Roy Storey (\s-1KIWIROY\s0) .PP Ilya Pavlov .PP David Mertens (run4flat) .PP Mark Nunberg (mordy, mnunberg) .PP Christian Walde (Mithaldu) .PP Brian Wightman (MidLifeXis) .PP Zaki Mughal (zmughal) .PP mohawk (mohawk2, \s-1ETJ\s0) .PP Vikas N Kumar (vikasnkumar) .PP Flavio Poletti (polettix) .PP Salvador Fandiño (salva) .PP Gianni Ceccarelli (dakkar) .PP Pavel Shaydo (zwon, trinitum) .PP Kang-min Liu (劉康民, gugod) .PP Nicholas Shipp (nshp) .PP Juan Julián Merelo Guervós (\s-1JJ\s0) .PP Joel Berger (\s-1JBERGER\s0) .PP Petr Pisar (ppisar) .PP Lance Wicks (\s-1LANCEW\s0) .PP Ahmad Fatoum (a3f, \s-1ATHREEF\s0) .PP José Joaquín Atria (\s-1JJATRIA\s0) .PP Duke Leto (\s-1LETO\s0) .PP Shoichi Kaji (\s-1SKAJI\s0) .PP Shawn Laffan (\s-1SLAFFAN\s0) .PP Paul Evans (leonerd, \s-1PEVANS\s0) .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2011\-2020 by Graham Ollis. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.