File Coverage

blib/lib/Tie/OrderedHash.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 22 22 100.0


line stmt bran cond sub pod time code
1             package Tie::OrderedHash;
2              
3 16     16   1636248 use 5.010;
  16         58  
4 16     16   86 use strict;
  16         117  
  16         520  
5 16     16   93 use warnings;
  16         71  
  16         910  
6 16     16   8058 use Tie::Hash ();
  16         14933  
  16         557  
7              
8             # Load via DynaLoader (not XSLoader) so dl_load_flags is honoured.
9             # We need RTLD_GLOBAL so our public C ABI (tie_oh_new /
10             # tie_oh_store / tie_oh_iter_*) is visible to consumer XS modules
11             # that link us via ExtUtils::Depends. Without RTLD_GLOBAL, Linux's
12             # dynamic loader keeps each .so's symbols in a local scope and any
13             # consumer (eg File::Raw::JSON) fails at load time with
14             # `undefined symbol: tie_oh_store`. macOS uses dynamic_lookup and
15             # defers resolution either way, hiding the bug locally. Same
16             # recipe File::Raw uses.
17             #
18             # XSLoader has a fast path that hard-codes dl_load_file flags=0 and
19             # doesn't honour dl_load_flags, so we go through DynaLoader instead.
20 16     16   101 use DynaLoader;
  16         25  
  16         1584  
21             our @ISA = ('Tie::Hash', 'DynaLoader');
22             our $VERSION = '0.03';
23 16     16 1 5375 sub dl_load_flags { 0x01 } # RTLD_GLOBAL
24              
25             __PACKAGE__->bootstrap($VERSION);
26              
27             1;
28              
29             __END__