File Coverage

blib/lib/Data/Graph/Shared.pm
Criterion Covered Total %
statement 14 15 93.3
branch 2 2 100.0
condition n/a
subroutine 4 5 80.0
pod 0 2 0.0
total 20 24 83.3


line stmt bran cond sub pod time code
1             package Data::Graph::Shared;
2 6     6   791458 use strict;
  6         12  
  6         268  
3 6     6   32 use warnings;
  6         11  
  6         1722  
4             our $VERSION = '0.04';
5             require XSLoader;
6             XSLoader::load('Data::Graph::Shared', $VERSION);
7              
8 0     0   0 sub CLONE_SKIP { 1 } # blessed C-pointer handle: never clone into ithreads (double-free)
9              
10             sub nodes {
11 1     1 0 829 my ($self) = @_;
12 1         3 my @nodes;
13 1         10 for my $i (0 .. $self->max_nodes - 1) {
14 10 100       35 push @nodes, $i if $self->has_node($i);
15             }
16 1         6 return @nodes;
17             }
18              
19             sub each_neighbor {
20 1     1 0 216137 my ($self, $node, $cb) = @_;
21 1         13 for my $pair ($self->neighbors($node)) {
22 2         12 $cb->($pair->[0], $pair->[1]);
23             }
24             }
25              
26             1;
27             __END__