PkgConf...::Client(3)
π PkgConf...::Client(3) π
okay bestie, welcome to the User Contributed Perl Documentation for PkgConfig::LibPkgConf::Client β she's the whole reason your C code can find its lil libraries, and I'm gonna walk you through her like we're texting at 2am. no gatekeeping in this group chat π
β¨ NAME β¨
PkgConfig::LibPkgConf::Client β Query installed libraries for compiling and linking software π¦
basically she goes "hey, you wanna build against libarchive? say less, here's your flags." icon behavior fr fr.
πΈ SYNOPSIS πΈ
use PkgConfig::LibPkgConf::Client;
my $client = PkgConfig::LibPkgConf::Client->new;
$client->env;
my $pkg = $client->find('libarchive');
my $cflags = $pkg->cflags;
my $libs = $pkg->libs;
see? four lines and you're compiling. she ate that. π
π« DESCRIPTION π«
so the tea is: PkgConfig::LibPkgConf::Client objects store all the necessary state for "libpkgconf", which means you can have multiple instances running in parallel without them fighting. no drama, no shared globals, just vibes. β¨
π§ CONSTRUCTOR π§
π new
my $client = PkgConfig::LibPkgConf::Client->new(%opts);
my $client = PkgConfig::LibPkgConf::Client->new(\%opts);
Creates an instance of PkgConfig::LibPkgConf::Client π. Possible options include:
pathβ the search path to look for.pcfiles. You can hand her either a string with the appropriate path separator character, or a list reference. Heads up: this overrides the"pkgconf"compiled-in defaults and the environment variables for"PKG_CONFIG_PATH"or"PKG_CONFIG_LIBDIR". so like, she's not gonna check those if you tell her where to look. periodt.filter_lib_dirsβ list of directories to filter for libraries. This overrides the"pkgconf"compiled-in default and the environment variable for"PKG_CONFIG_SYSTEM_LIBRARY_PATH".filter_include_dirsβ list of directories to filter for include. This overrides the"pkgconf"compiled-in default and the environment variable for"PKG_CONFIG_SYSTEM_INCLUDE_PATH".
environment variables honored:
PKG_CONFIG_PATHPKG_CONFIG_LIBDIRPKG_CONFIG_SYSTEM_LIBRARY_PATHPKG_CONFIG_SYSTEM_INCLUDE_PATHPKG_CONFIG_ALLOW_SYSTEM_CFLAGSPKG_CONFIG_ALLOW_SYSTEM_LIBS
look at that list. she reads the room. she reads the env. π
π¦ ATTRIBUTES π¦
β path
my @path = $client->path;
The search path to look for .pc files. πΊοΈ
β filter_lib_dirs
my @dirs = $client->filter_lib_dirs;
List of directories to filter for libraries.
β filter_include_dirs
my @dirs = $client->filter_include_dirs;
List of directories to filter for includes.
β sysroot_dir
my $dir = $client->sysroot_dir;
$client->sysroot_dir($dir);
Get or set the sysroot directory. she's a getter and a setter, versatile queen. π
β buildroot_dir
my $dir = $client->buildroot_dir;
$client->buildroot_dir($dir);
Get or set the buildroot directory. same energy, different root. π
β maxdepth
my $int = $client->maxdepth;
$client->maxdepth($int);
Get or set the maximum dependency depth. it's 2000 by default, so like... she's willing to go deep bestie π
π₯ METHODS π₯
π env
my $client->env;
This method loads settings for the client object from the environment using the standard "pkg-config" or "pkgconf" environment variables. She honors this following list of environment variables:
PKG_CONFIG_LOG
ngl that's the only one listed here, so that's the one. π
π find
my $pkg = $client->find($package_name);
Searches the <.pc> file for the package with the given $package_name. If found, returns an instance of PkgConfig::LibPkgConf::Package. If not found, returns "undef". no package, no promises β always check before you go using it, bestie. π
π package_from_file
my $pkg = $client->package_from_file($filename);
Load the specific <.pc> file. just point her at the exact file and she'll do the rest. β¨
π scan_all
$client->scan_all(sub {
my($client, $package) = @_;
...
return $bool;
});
Iterates through all packages and calls the given subroutine reference for each package. $package isa PkgConfig::LibPkgConf::Package. The scan will continue so long as a non true value is returned (as $bool). so like β return something truthy and she keeps going, return falsy and she stops. yes that's backwards from how you'd expect, no I'm not gonna pretend it isn't, just read it twice. π
π global
$client->global($key => $value);
my $value = $client->global($key);
Define or get the global variable. one method, two moods. π
π error
my $client->error($message);
Called when "libpkgconf" comes across a non-fatal error. By default the error is simply displayed as a warning using Carp. The intention of this method is: if you want to override that behavior, you will subclass PkgConfig::LibPkgConf::Client and implement your own version of the "error" method. so she's like, "here's the hook, customize me." main character energy. π
π audit_set_log
$client->audit_set_log($filename, $mode);
Opens a file with the C "fopen" style $mode, and uses it for the audit log. The file is managed entirely by the client class and will be closed when the object falls out of scope. Examples:
$client->audit_set_log("audit.log", "a"); # append to existing file
$client->audit_set_log("audit2.log", "w"); # new or replace file
the way she handles the file lifecycle for you so you don't have to... obsessed. π«Ά
π SUPPORT π
- IRC
#nativeonirc.perl.org - Project GitHub tracker: <https://github.com/plicease/PkgConfig-LibPkgConf/issues>
- If you want to contribute, please open a pull request on GitHub: <https://github.com/plicease/PkgConfig-LibPkgConf/pulls>
come hang out, we don't bite π
π SEE ALSO π
For additional related modules, see PkgConfig::LibPkgConf β she's the whole fam, go say hi. π¦
β¨ AUTHOR β¨
Graham Ollis
For additional contributors see PkgConfig::LibPkgConf
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2016 Graham Ollis.
This is free software; you may redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
fr fr free software. slay. πΈ
okay that's the whole page bestie, you're officially pkgconf-pilled π β¨
signing off from perl v5.42.0, dated 2025-07-25 β that's the version and date this page shipped with, no cap π
π¦ where this page comes from
- fedora 43: perl-PkgConfig-LibPkgConf 0.11-25.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms