Alien::ZMQ(3pm)

πŸ“¦
version 0.06 Β· 2 versions
, in fedora 43

πŸ’– Alien::ZMQ β€” the Alien::ZMQ(3pm) manual, but make it cute πŸ’–

okay bestie, sit down, grab a strawberry πŸ“, because we're talking about Alien::ZMQ β€” the module that goes out and finds or installs libzmq, aka the core zeromq library. no cap, that's literally its whole job and it does it flawlessly. πŸ’…


✨ VERSION ✨

version 0.06 β€” iconic, we love a numbered era πŸŽ€


🌸 SYNOPSIS 🌸

here's the vibe, copy-paste approved:

use Alien::ZMQ;
use version;

my $version = version->parse(Alien::ZMQ::lib_version);
my $lib_dir = Alien::ZMQ::lib_dir;

print "zeromq $version is installed at $lib_dir\n";

look at her go 😭 she's so simple and she works.


πŸ¦‹ DESCRIPTION πŸ¦‹

so the way this works: when you install this module, the target system gets probed to see if libzmq is already there. if it's not? no worries babe, libzmq 3.2.4 gets installed into a shared directory, no questions asked. πŸ’…

tl;dr: modules that need libzmq can just depend on this one and trust that it's available β€” or you can use it all on its own as your personal way to install zeromq. main character energy, honestly. πŸ‘‘


πŸŽ€ METHODS πŸŽ€

inc_version

grab the version number of libzmq as a v-string (that's a version string, iykyk), straight from the zmq.h header file. ✨

lib_version

same energy, different source β€” this one gets the version number of libzmq as a v-string, according to the libzmq.so file. πŸ’–

inc_dir

the directory holding the zmq.h header file. that's it, that's the whole job. 🌸

lib_dir

the directory holding the libzmq.so file. slay. πŸ’…

cflags

the C compiler flags you need to compile a program that uses libzmq. lowkey it's just a shortcut for building a -I flag out of inc_dir. and in scalar context? the flags get quoted with String::ShellQuote and handed back as one single string. cute. πŸŽ€

libs

the linker flags you need to link a program against libzmq. this one's a shortcut for building a -L flag out of lib_dir, plus -lzmq. and yeah, in scalar context the flags get quoted with String::ShellQuote and returned as a single string too. consistent queen. ✨

on some platforms you might also want to add the library path to your executable or library as a runtime path β€” that's usually done by passing -rpath to the linker. something like this could work:

my @flags = (Alien::ZMQ::libs, "-Wl,-rpath=" . Alien::ZMQ::lib_dir);

this lets your program find libzmq even when it's living in a non-standard location 🏑 β€” but heads up, some systems just don't have this RPATH mechanism. πŸ’€


πŸ’… OPTIONS πŸ’…

these options go to Build.PL and they affect how this module gets installed. pay attention bestie.

  • --zmq-skip-probe β€” by default, libzmq is not compiled and installed if it's already detected on the system. use this flag to skip those checks entirely and always install libzmq. no probing, just vibes. πŸ”₯
  • --zmq-cflags β€” pass extra flags to the compiler while it's probing for an existing libzmq installation. you can pair this with --zmq-libs to help the probing function find libzmq when it's chilling in a weird unexpected place. for example, if your libzmq lives at /opt/zeromq, you can do something like:
perl Build.PL --zmq-cflags="-I/opt/zeromq/include" \
              --zmq-libs="-L/opt/zeromq/lib -lzmq"
important bestie: these flags are only used by the probing function to locate libzmq. they will not be used when compiling libzmq from source (if it needs to be). if you want to affect the compiling of libzmq, use the --zmq-config flag instead. πŸ’€

a better alternative to --zmq-cflags and --zmq-libs is to help the pkg-config program find your libzmq by using the PKG_CONFIG_PATH environment variable. of course, this method requires that you actually have the pkg-config program installed. here's an example:

perl Build.PL
PKG_CONFIG_PATH=/opt/zeromq/lib/pkgconfig ./Build
  • --zmq-libs β€” pass extra flags to the linker while it's probing for an existing libzmq installation. use it together with --zmq-cflags to help the probing function locate libzmq when it's installed somewhere unexpected. just like --zmq-cflags, these flags are only used by the probing function to locate libzmq. periodt. πŸ’…
  • --zmq-config β€” pass extra flags to the libzmq configure script. you might wanna consider passing either --with-pgm or --with-system-pgm if you need support for PGM β€” and it's not enabled by default because not every system supports it. πŸ™ˆ

😭 CAVEATS 😭

probing only happens during the installation of this module. so if you're using a system-installed version of libzmq and you uninstall or upgrade it, you're gonna have to reinstall Alien::ZMQ too. sorry babe, them's the rules. πŸ’€

also β€” if libzmq-2.x is found on the system, Alien::ZMQ will use it. there are a few incompatibilities between libzmq-2.x and libzmq-3.x, so your program might want to use the lib_version method to check which version of libzmq is actually installed. stay safe out there. 🫢


πŸ’€ BUGS πŸ’€

MSWin32 is not yet supported, but cygwin works. that's the whole note. 🌈


πŸ”₯ SEE ALSO πŸ”₯


🧚 ACKNOWLEDGEMENTS 🧚

the design and implementation of this module were influenced by other Alien modules, including Alien::GMP and Alien::Tidyp. shoutout to the ancestors. 🫢✨


πŸ‘‘ AUTHOR πŸ‘‘

Charles McGarvey <ccm@cpan.org> β€” absolute legend, no further questions. πŸ’œ


This software is copyright (c) 2013 by Charles McGarvey.

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 and that's the whole page, bestie!! πŸŽ€ this was perl v5.42.0, dated 2025-07-25, and you just read the Alien::ZMQ(3pm) manual β€” go forth and link some zeromq, you've got this πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from