perl-alien

Write and debug Alien::Build alienfiles that provide C libraries to CPAN modules.

1|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/Getty/p5-alien-libssh --skill perl-alien-getty
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: perl-alien
Source: https://github.com/Getty/p5-alien-libssh/tree/main/.claude/skills/perl-alien
Command: npx skills add https://github.com/Getty/p5-alien-libssh --skill perl-alien-getty

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Perl XS and FFI modules need C libraries to link against, and authors must decide at install time whether to use a system library or build one from source. This Skill guides writing and debugging Alien::Build alienfiles so that probing, building, and flag gathering work correctly on every machine, including air-gapped hosts. ## Core Features & Use Cases - Alienfile authoring: Structure probe, sys, and share blocks correctly, use the PkgConfig plugin with a justified minimum_version, and bundle source tarballs via Fetch::Local for network-free installs. - Correct flag handling: Avoid hardcoded paths by using %{.install.prefix} interpolation, and understand install_prop versus runtime_prop so cflags and libs survive into alien.json. - Consumption and testing: Wire Alien::Base into XS Makefile.PL or FFI::Platypus consumers via configure_requires, and prove both system and share install paths with Test::Alien xs_ok snippets. - Use Case: You are packaging Net::LibSSH and need Alien::libssh to detect a system libssh 0.9+ via pkg-config, fall back to building a bundled tarball with CMake, and expose cflags and libs to your XS module. ## Quick Start Ask the AI to write an alienfile for a C library that probes with pkg-config, falls back to building a bundled tarball with CMake, and shows how an XS module consumes the resulting cflags and libs.

Frequently Asked Questions about perl-alien

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write an alienfile for a C library in Perl?

Use Alien::Build with a PkgConfig plugin for probing and a share block that fetches, extracts, and builds the source. Name the build plugin family like Build::CMake and use %{.install.prefix} instead of hardcoded paths.

How do I use Alien::Base cflags and libs in an XS module?

Call Alien::Foo->libs and Alien::Foo->cflags in the consumer's Makefile.PL and pass them to WriteMakefile as LIBS and INC. List the Alien in configure_requires, since Makefile.PL needs it before a plain requires would install it.

Should I bundle the source tarball or fetch it from upstream?

Bundling with a file:// start_url and Fetch::Local makes installs work without network access, at the cost of distribution size and manual version bumps. Fetching from upstream keeps the distribution small but adds a download to every install.

Why does my Alien share build never get tested?

On a machine that already has the library, the probe always picks the system path. Force each path with ALIEN_INSTALL_TYPE=share or =system and run both in CI, since they exercise different code.

How do I test that an Alien produces working compiler flags?

Use Test::Alien's xs_ok to compile a real XS snippet against the flags, and call an actual library function rather than only including a header. This covers probe, build, gather, and flags as one chain.

Can FFI::Platypus use an Alien-provided library?

Yes, pass Alien::Foo->dynamic_libs as the lib argument to FFI::Platypus. The share build must produce a shared library, for example with -DBUILD_SHARED_LIBS=ON for CMake, or dynamic_libs returns empty.