Alien-SNMP
view release on metacpan or search on metacpan
lib/Alien/SNMP.pm view on Meta::CPAN
package Alien::SNMP;
use strict;
use warnings;
use 5.010001;
use parent qw(Alien::Base);
our $VERSION = '4.0509050202';
# Preload the dynamic Net-SNMP library with global symbol visibility so that
# the bundled SNMP XS module (which has `use Alien::SNMP;` injected ahead of
# its XSLoader call) and any downstream XS resolve libnetsnmp from our share
# dir whatever path was baked into them: the loader matches the already-loaded
# image by SONAME on ELF, and by install name on darwin. This is what lets the
# test suite pass before `make install` populates the final share dir (the
# window CPAN Testers run in), and lets the distribution work with no
# system-level libnetsnmp present.
# Best-effort: never let a failure here break `use Alien::SNMP` (e.g. when the
# module is loaded from source before the share dir exists). The baked-in
# run-path still resolves libnetsnmp once the share is installed.
t/04_flags.t view on Meta::CPAN
}
for my $lib_dir (@lib_dirs) {
ok -d $lib_dir, "libs__share_build__lib_dir_exists ($lib_dir)";
}
# A bare failure here says nothing about *which* directory was searched, and the
# advertised -L is not necessarily the Alien's own: a Solaris smoker failed this
# with an empty dynamic_libs while t/02_compile.t linked and ran fine, which is
# what a foreign -L sorting first would look like. Report all of them.
ok scalar(glob "$lib_dirs[0]/libnetsnmp.*"),
'libs__share_build__contains_a_libnetsnmp'
or diag "nothing matches libnetsnmp.* in $lib_dirs[0]\n"
. "libs is: " . Alien::SNMP->libs . "\n"
. "all advertised lib dirs and what each holds:\n"
. join '', map {
# Not s///r: this distribution supports back to perl 5.10, and the
# /r modifier arrived in 5.14.
my @found = map { my $f = $_; $f =~ s{.*/}{}; $f }
glob "$_/libnetsnmp*";
" $_\n" . (@found ? " @found\n" : " (no libnetsnmp* here)\n")
} @lib_dirs;
done_testing;
t/07_alienfile_hygiene.t view on Meta::CPAN
# Comment lines are stripped: the recipe documents *why* it no longer touches these
# things, and that prose must not read as a violation.
my $alienfile = join "\n", grep { !/^\s*#/ } split /\n/, _slurp('alienfile');
# A substitution whose pattern mentions DESTDIR, e.g. s/^\Q$destdir\E// -- the only
# reason to write one is to turn a staged path back into a live one. Bounded to a
# single statement so an unrelated later mention cannot trip it.
unlike $alienfile, qr/=~ \s* s [^;]{0,120} DESTDIR/xi,
'alienfile__build_recipe__never_strips_DESTDIR_to_rebuild_an_absolute_path';
# perllocal.pod is an append-only global manifest and .packlist is per-install
# bookkeeping; both belong to whatever installs this distribution, never to us.
foreach my $artifact (qw( perllocal.pod .packlist )) {
unlike $alienfile, qr/\Q$artifact\E/,
"alienfile__build_recipe__does_not_handle_$artifact";
}
done_testing;
sub _slurp {
my ($file) = @_;
( run in 0.817 second using v1.01-cache-2.11-cpan-4716db65a44 )