Alien::...:Plugin(3)

πŸ’– Alien::Build::Plugin β€” the plugin base class, bestie πŸ’–

okay so this page is Alien::...:Plugin(3) from the User Contributed Perl Documentation and it's literally the origin story for every Alien::Build plugin. pull up a chair 🫢


✨ NAME ✨

Alien::Build::Plugin β€” the plugin base class for Alien::Build. periodt.

🌸 VERSION 🌸

version 2.88 β€” yeah she's been around, she's iconic πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

bestie, here's how you make 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' ],
  });
}

and then from your alienfile you pull up like:

use alienfile;
plugin 'Type::MyPlugin' => (
  prop2 => 'different value',
  prop3 => 'need to provide since it is required',
);

see how prop3 had to get passed in? that's the required-property thing doing its job πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

this doc describes the Alien::Build plugin base class. but bestie β€” if you actually wanna learn how to write a plugin, go read Alien::Build::Manual::PluginAuthor instead, that's the real one. iykyk.

here are the common types of plugins, and yes every single one of them is in here:

  • Alien::Build::Plugin::Build β€” tools for building. πŸ› οΈ
  • Alien::Build::Plugin::Core β€” tools that are already included. no download needed, they came with the vibes.
  • Alien::Build::Plugin::Decode β€” normally you use Download plugins, which will pick the correct Decode plugins for you.
  • Alien::Build::Plugin::Digest β€” tools for checking cryptographic signatures during a "share" install. security girlie behavior πŸ”
  • Alien::Build::Plugin::Download β€” methods for retrieving from the internet.
  • Alien::Build::Plugin::Extract β€” extract from archives that have been downloaded.
  • Alien::Build::Plugin::Fetch β€” normally you use Download plugins, which will pick the correct Fetch plugins.
  • Alien::Build::Plugin::Gather β€” plugins that modify or enhance the gather step.
  • Alien::Build::Plugin::PkgConfig β€” plugins that work with "pkg-config" or libraries that provide the same functionality.
  • Alien::Build::Plugin::Prefer β€” normally you use Download plugins, which will pick the correct Prefer plugins.
  • Alien::Build::Plugin::Probe β€” look for packages already installed on the system.
  • Alien::Build::Plugin::Probe β€” plugins useful for unit testing Alien::Build itself, or plugins for it.
and yes bestie, Alien::Build::Plugin::Probe really is listed twice in the original. not a typo on my end, i'm keeping it exactly as it is πŸ’€

πŸ‘‘ CONSTRUCTOR πŸ‘‘

🌈 new 🌈

my $plugin = Alien::Build::Plugin->new(%props);

that's it. that's the constructor. slay.


πŸ’œ PROPERTIES πŸ’œ

⭐ instance_id ⭐

my $id = $plugin->instance_id;

returns an instance id for the plugin. it gets computed from the class and the arguments you 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. fr fr, don't do it.


πŸ’… METHODS πŸ’…

🧚 init 🧚

$plugin->init($ab_class->meta); # $ab is an Alien::Build class name

you provide the implementation for this one, bestie. the whole intent is to register hooks and set meta properties on the Alien::Build class. main character energy, honestly.

πŸ“ has πŸ“

has $prop_name;
has $prop_name => $default;

specifies a property of the plugin. you can hand it a default value as either a string scalar, or a code reference. the code reference gets called to compute the default value β€” and if you want the default to be a list or a hash reference, this is literally how you want to do it:

has foo => sub { [1,2,3] };

🌸 meta 🌸

my $meta = $plugin->meta;

returns the plugin meta object. that's the whole thing, no notes ✨


πŸ’– SEE ALSO πŸ’–

  • Alien::Build
  • alienfile
  • Alien::Build::Manual::PluginAuthor

🫢 AUTHOR 🫢

Author: Graham Ollis <plicease@cpan.org>

Contributors β€” the whole group chat, every single one of them, no cap:

  • 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
  • Marcel Telka (mtelka)

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.


okay that's the whole page bestie, you ate it up πŸ’– this was Alien::...:Plugin(3) as shipped with perl v5.42.3 on 2026-09-21 β€” go forth and write plugins, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from