p5pclub / ref-util

Ref::Util - Utility functions for checking references
6 stars 11 forks source link

Fix compilation for perls lacking SvRX #29

Closed dur-randir closed 7 years ago

dur-randir commented 8 years ago

Commit 13d666855b971ae6f127e0bd9baa2dd5c56ddbc7 broke this module for 5.8.x perl series with the following output:

PERL_DL_NONLAZY=1 "/Users/dur-randir/perlbrew/perls/perl-5.8.9-dbg/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/arrayref.t ... 1/7
#   Failed test 'use Ref::Util;'
#   at t/arrayref.t line 6.
#     Tried to use 'Ref::Util'.
#     Error:  Can't load '/Users/dur-randir/Projects/Ref-Util/blib/arch/auto/Ref/Util/Util.bundle' for module Ref::Util: dlopen(/Users/dur-randir/Projects/Ref-Util/blib/arch/auto/Ref/Util/Util.bundle, 2): Symbol not found: _DPPP_my_SvRX
#   Referenced from: /Users/dur-randir/Projects/Ref-Util/blib/arch/auto/Ref/Util/Util.bundle
#   Expected in: dynamic lookup
#  at t/arrayref.t line 6.
# Compilation failed in require at t/arrayref.t line 6.
# BEGIN failed--compilation aborted at t/arrayref.t line 6.
Undefined subroutine &Ref::Util::is_arrayref called at t/arrayref.t line 11.

So, add a directive for ppport.h to include SvRX fallback.

xsawyerx commented 8 years ago

Hi. :)

Thanks for this fix!

Could you please help me understand it better before I merge it?

dur-randir commented 8 years ago

ppport.h provides some things (like macro expansions) just after you include it. But for other things (mostly ones that are implemented as a function and not as a macro) it requires an explicit request by defining NEED_xxx or NEED_xxx_GLOBAL macro. That can be checked by perl ppport.h --api-info=SvRX:

Support needs to be explicitly requested by NEED_SvRX.

pghmcfc commented 8 years ago

I agree that this is the correct way to fix this issue.

xsawyerx commented 7 years ago

Merged. Thanks!!