NAME
Alien::Xrepo::Runtime::Alt - A package-bound view of an Alien::Xrepo::Runtime
SYNOPSIS
my $sdl3 = Exotic::SDL3->new;
# every accessor defaults to the recipe's primary package
$sdl3->cflags;
# alt() binds the same accessors to another package in the family
my $ttf = $sdl3->alt('libsdl3_ttf');
$ttf->version;
$ttf->cflags;
$ttf->libpath;
DESCRIPTION
Alien::Xrepo::Runtime::Alt is the small adapter "alt" in Alien::Xrepo::Runtime returns when the requested package is not the recipe's primary package. It holds a reference to the owning runtime and a single package name, and forwards every consumer accessor to the owner with that name supplied.
It exists so a multi-package Alien can hand a consumer an object whose accessors all answer for one library. This mirrors Alien::Base's alt( ) model: an FFI or XS binding written for one library in a family (the SDL3 core, say, or its ttf extension) can take an object that does not have to be told which package it is for on every call.
The object is a thin view: it stores no state of its own beyond the package name. Calling alt( ) on it returns the Alt for another package (or the base runtime, for the primary), so navigation is uniform. Requesting an unknown package dies, exactly as it does on the runtime itself.
CONSTRUCTOR
my $alt = Alien::Xrepo::Runtime::Alt->new(
base => $runtime, # the owning Alien::Xrepo::Runtime
pkg => 'libsdl3_ttf' # the package to bind accessors to
);
Instances are created for you by "alt" in Alien::Xrepo::Runtime; there is no reason to construct one directly.
ATTRIBUTES
- pkg_name
-
The single package name this view is bound to. (Compare the runtime's
package_names( ), which lists every package in the recipe.)
METHODS
Every method delegates to the owning runtime with pkg_name supplied as the package argument, so each behaves exactly like its Alien::Xrepo::Runtime counterpart bound to this one package:
package_names( )package_info( )alt( [$name] )-
Returns the view for another package (or the base runtime, for the primary).
version( )kind( )dist_dir( )install_type( )cflags( )cflags_static( )libs( )libs_static( )split_flags( $flags )find_header( $filename )libpath( )ffi_lib( )dynamic_libs( )bin_dir( )prepend_to_path( )-
Prepends this package's binary directories to
$ENV{PATH}. runtime_deps( )foreign_runtime_deps( )runtime_dep_dirs( )loader_env_var( )runtime_dep_report( )
SEE ALSO
Alien::Xrepo::Runtime, Alien::Xrepo, Alien::Xrepo::PackageInfo
LICENSE
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.
AUTHOR
Sanko Robinson https://github.com/sanko