File Coverage

blib/lib/Heap/Simple.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Heap::Simple;
2 1     1   11995 use Carp;
  1         3  
  1         94  
3 1     1   7 use strict;
  1         5  
  1         46  
4              
5             # Switch selecting XS or pure perl
6 1     1   7 use vars qw($VERSION @ISA @implementors);
  1         6  
  1         970  
7             $VERSION = "0.13";
8              
9             unless (@ISA) {
10             @implementors = qw(Heap::Simple::XS(0.10) Heap::Simple::Perl(0.13))
11             unless @implementors;
12             for my $i (@implementors) {
13             my $plugin = $i;
14             my $version = $plugin =~ s/\((.+)\)\z// ? $1 : undef;
15             my $p = "$plugin.pm";
16             $p =~ s!::!/!g;
17             if (eval { require $p; 1 }) {
18             *new = $plugin->can("new") ||
19             croak "Package '$plugin' does not support 'new'";
20             if (defined $version) {
21             if (defined(my $v = $plugin->VERSION)) {
22             if ($v < $version) {
23             carp "Need '$plugin' version $version, found version $v";
24             next;
25             }
26             } else {
27             croak "Could not determine the version of '$plugin'";
28             }
29             }
30             @ISA = ($plugin);
31             last;
32             }
33             }
34             @ISA || croak "Can't locate ", join(" nor ", @implementors), " in \@INC. This probably means you didn't install any of them. (\@INC contains: @INC)";
35             }
36              
37             1;
38             __END__