File Coverage

blib/lib/SNA/Network/Edge.pm
Criterion Covered Total %
statement 18 18 100.0
branch 5 8 62.5
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 29 32 90.6


line stmt bran cond sub pod time code
1             package SNA::Network::Edge;
2              
3 14     14   76 use warnings;
  14         28  
  14         403  
4 14     14   75 use strict;
  14         39  
  14         456  
5              
6 14     14   2117 use Carp qw(croak);
  14         55  
  14         767  
7 14     14   75 use Object::Tiny::XS qw(source target weight);
  14         24  
  14         96  
8              
9             =head1 NAME
10              
11             SNA::Network::Edge - Edge class for SNA::Network
12              
13              
14             =head1 SYNOPSIS
15              
16             Quick summary of what the module does.
17              
18             Perhaps a little code snippet.
19              
20             use SNA::Network::Edge;
21              
22             my $foo = SNA::Network::Edge->new();
23             ...
24              
25              
26             =head1 METHODS
27              
28             =head2 new
29              
30             Create a new edge with source, target and weight.
31              
32             =cut
33              
34             sub new {
35 4027     4027 1 12576 my ($package, %params) = @_;
36 4027 50       8940 croak unless defined $params{source};
37 4027 50       7069 croak unless defined $params{target};
38 4027 50       16388 croak unless defined $params{index};
39 4027 100       6890 $params{weight} = 1 unless defined $params{weight};
40 4027         30811 return bless { %params }, $package;
41             }
42              
43              
44             =head2 source
45              
46             Returns the source node object of the edge.
47              
48              
49             =head2 target
50              
51             Returns the target node object of the edge.
52              
53             =head2 weight
54              
55             Returns the weight of the edge.
56              
57              
58             =head1 AUTHOR
59              
60             Darko Obradovic, C<< >>
61              
62             =head1 BUGS
63              
64             Please report any bugs or feature requests to C, or through
65             the web interface at L. I will be notified, and then you'll
66             automatically be notified of progress on your bug as I make changes.
67              
68              
69              
70              
71             =head1 SUPPORT
72              
73             You can find documentation for this module with the perldoc command.
74              
75             perldoc SNA::Network
76              
77              
78             You can also look for information at:
79              
80             =over 4
81              
82             =item * RT: CPAN's request tracker
83              
84             L
85              
86             =item * AnnoCPAN: Annotated CPAN documentation
87              
88             L
89              
90             =item * CPAN Ratings
91              
92             L
93              
94             =item * Search CPAN
95              
96             L
97              
98             =back
99              
100              
101             =head1 ACKNOWLEDGEMENTS
102              
103              
104             =head1 COPYRIGHT & LICENSE
105              
106             Copyright 2009 Darko Obradovic, all rights reserved.
107              
108             This program is free software; you can redistribute it and/or modify it
109             under the same terms as Perl itself.
110              
111              
112             =cut
113              
114             1; # End of SNA::Network::Edge