Go to main content

man pages section 3: Library Interfaces and Headers

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

Alien::Build::Plugin (3)

Name

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

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) = @_;

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',
);

Description

User Contributed Perl Documentation                    Alien::Build::Plugin(3)



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

VERSION
       version 1.89

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) = @_;

          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',
        );

DESCRIPTION
       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:

       Alien::Build::Plugin::Build
           Tools for building.

       Alien::Build::Plugin::Core
           Tools already included.

       Alien::Build::Plugin::Download
           Methods for retrieving from the internet.

       Alien::Build::Plugin::Decode
           Normally use Download plugins which will pick the correct Decode
           plugins.

       Alien::Build::Plugin::Extract
           Extract from archives that have been downloaded.

       Alien::Build::Plugin::Fetch
           Normally use Download plugins which will pick the correct Fetch
           plugins.

       Alien::Build::Plugin::Prefer
           Normally use Download plugins which will pick the correct Prefer
           plugins.

       Alien::Build::Plugin::Probe
           Look for packages already installed on the system.

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.

   subplugin
       DEPRECATED: Maybe removed, but not before 1 October 2018.

        my $plugin2 = $plugin1->subplugin($plugin_name, %args);

       Finds the given plugin and loads it using Module::Load (unless already
       loaded) and creats a new instance and returns it.  Most useful from a
       Negotiate plugin, like this:

        sub init
        {
          my($self, $meta) = @_;
          $self->subplugin(
            'Foo::Bar',  # 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);
        }

   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.


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+--------------------------------+
       |ATTRIBUTE TYPE |        ATTRIBUTE VALUE         |
       +---------------+--------------------------------+
       |Availability   | library/perl-5/alien-build-532 |
       +---------------+--------------------------------+
       |Stability      | Volatile                       |
       +---------------+--------------------------------+

SEE ALSO
       Alien::Build, alienfile, Alien::Build::Manual::PluginAuthor

AUTHOR
       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 Fandio (salva)

       Gianni Ceccarelli (dakkar)

       Pavel Shaydo (zwon, trinitum)

       Kang-min Liu (, gugod)

       Nicholas Shipp (nshp)

       Juan Julin Merelo Guervs (JJ)

       Joel Berger (JBERGER)

       Petr Pisar (ppisar)

       Lance Wicks (LANCEW)

       Ahmad Fatoum (a3f, ATHREEF)

       Jos Joaqun Atria (JJATRIA)

       Duke Leto (LETO)

       Shoichi Kaji (SKAJI)

       Shawn Laffan (SLAFFAN)

       Paul Evans (leonerd, PEVANS)

COPYRIGHT AND LICENSE
       This software is copyright (c) 2011-2019 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.



NOTES
       Source code for open source software components in Oracle Solaris can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This software was built from source available at
       https://github.com/oracle/solaris-userland.  The original community
       source was downloaded from
       http://www.cpan.org/authors/id/P/PL/PLICEASE/Alien-Build-1.89.tar.gz.

       Further information about this software can be found on the open source
       community website at http://search.cpan.org/dist/Alien-Build/.



perl v5.32.0                      2019-09-25           Alien::Build::Plugin(3)