Alien::Role(3)

πŸ’– Alien::Role β€” the Perl manual page, but make it a group chat πŸ’–

okay bestie, welcome to Alien::Role(3), a User Contributed Perl Documentation page, and honestly? it's giving "small but iconic." let's get into it πŸ¦‹


✨ NAME ✨

Alien::Role β€” literally just: extend Alien::Base with roles! that's the whole vibe. periodt. πŸ’…


🌸 VERSION 🌸

version 2.88 β€” yes, she has a version number, she's official, she's got her life together. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

here's the whole entire flex, copy it exactly bestie:

package Alien::libfoo;

use parent qw( Alien::Base );
use Role::Tiny::With qw( with );

with 'Alien::Role::Dino';

1;

like… look at that. clean. minimal. main character energy fr fr. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the <pink>Alien::Role</pink> namespace exists for one single gorgeous purpose: writing roles that can be applied to Alien::Base to extend its functionality. that's it, that's the assignment. 🫢

and like, you could totally write subclasses that extend Alien::Base instead β€” nobody's stopping you β€” but then you're stuck with the consequences, bestie. you have to either stick with just one subclass, or deal with multiple inheritance 😭 and we all know how that ends. it's giving chaos. it's giving spaghetti. no thank you.

so the recommendation is: use Role::Tiny. why? because it can be used on plain old Perl classes, which is so good, because Alien::Base doesn't use anything fancy like Moose or Moo. it's just a normal lil guy doing normal lil guy things. 🌸

there's one working example that uses this technique and it is genuinely worth checking out in the event you are interested: Alien::Role::Dino. go look. she's cute. she's the blueprint. πŸ¦•

and lowkey important: this class itself doesn't do anything. it just documents the technique. she's not a worker, she's a narrator. πŸ’…


🌈 SEE ALSO 🌈

go read these too, bestie, they're all connected:

  • Alien
  • Alien::Base
  • alienfile
  • Alien::Build
  • Alien::Role::Dino

πŸ‘‘ AUTHOR πŸ‘‘

Author: Graham Ollis <plicease@cpan.org>

Contributors β€” and there are so many of them, this is a whole squad, a whole community, a whole collab πŸ”₯:

  • 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)

every single one of them, named and credited, because we do not erase people's work in this house. πŸ’–


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.

translation: it's free, it's open, it's yours to remix β€” same terms as Perl 5 itself. slay. ✨

aaaand that's the whole page bestie!! πŸŽ€ this was generated by perl v5.42.3 on 2026-09-21, and it lives at Alien::Role(3) in the User Contributed Perl Documentation. mwah, go write some roles, ily, bye!! πŸ’–πŸ¦‹πŸŒΈπŸ‘‘πŸ’…

πŸ“¦ where this page comes from