| 1 | 2 | ▶ | use 5.001; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use HTTP::Cookies; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use HTTP::Response; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use JSON; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use vars qw($VERSION $errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | binmode STDOUT, ":utf8"; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | binmode STDERR, ":utf8"; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # WWW::Geni class | ||||||||||||||||||||||||||||||||||||||||||
| 16 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 17 | { | ||||||||||||||||||||||||||||||||||||||||||
| 18 | package WWW::Geni; | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | our $VERSION = '0.3.0'; | |||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | our $geni; | |||||||||||||||||||||||||||||||||||||||||
| 21 | # Profile APIs | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # Returns a data structure containing the immediate family of the requested | ||||||||||||||||||||||||||||||||||||||||||
| 23 | # profile. | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | my $self = { @_ }; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ($self->{user}, $self->{pass}) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | $self->{json} = new JSON; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | if (!$self->{user} || !$self->{pass}){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{'user'} && $self->{'pass'}
MC/DC0%0/2
$self->{'user'} && $self->{'pass'}
$self->{'user'}
$self->{'pass'}
Truth table33%1/3
A && B
A= $self->{'user'}B= $self->{'pass'}
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | $WWW::Geni::errstr = "Username and password are required parameters to " | |||||||||||||||||||||||||||||||||||||||||
| 31 | . "WWW::Geni::new()."; | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 33 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | $self->login() or $WWW::Geni::errstr = "Login failed!" && return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | $WWW::Geni::geni = $self; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | sub user { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
user: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | return $self->{user}; | |||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub login { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
login: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | $self->{ua} = LWP::UserAgent->new(); | |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | $self->{ua}->cookie_jar(HTTP::Cookies->new()); | |||||||||||||||||||||||||||||||||||||||||
| 50 | my $res = $self->{ua}->post("https://www.geni.com/login/in?username=" | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | . $self->{user} . "&password=" . $self->{pass}); | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | return $res->content =~ /home">redirected/; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub tree_conflicts() { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tree_conflicts: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | my $list = WWW::Geni::List->new(); | |||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $self->_populate_tree_conflicts($list) or | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | $WWW::Geni::errstr = "Attempt to [re]populate tree conflict list failed." && return 0; | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | return $list; | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | # Returns a data structure containing the immediate family of the requested profile. | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub _profile_get_immediate_family_url($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_profile_get_immediate_family_url: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my ($self, $profile) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | $profile = $profile ? $profile : "profile"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | "https://www.geni.com/api/$profile/immediate-family?only_ids=true"; | |||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | # Returns a list of requested profile merges for the current user. | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub _profile_get_merges_url { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_profile_get_merges_url: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 72 | "https://www.geni.com/api/profile/merges?only_ids=true" | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | . ($self->{collaborators} ? "&collaborators=true" : ""); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | # Returns a list of data conflicts for the current user. | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub _profile_get_data_conflicts_url { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_profile_get_data_conflicts_url: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 78 | "https://www.geni.com/api/profile/data-conflicts?only_ids=true" | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | . ($self->{collaborators} ? "&collaborators=true" : ""); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | # Returns a list of tree conflicts for the current user. | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub _profile_get_tree_conflicts_url($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_profile_get_tree_conflicts_url: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 84 | "https://www.geni.com/api/profile/tree-conflicts?only_ids=true" | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | . ($self->{collaborators} ? "&collaborators=true" : "") . "&page=" . (shift or '1'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
shift() || '1'
MC/DC0%0/1
shift() || '1'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | # Returns a list of other profiles in our system matching a given profile. | ||||||||||||||||||||||||||||||||||||||||||
| 88 | # Only users who have upgraded to a Geni Pro Account can see this list. | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | sub _profile_get_tree_matches_url($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_profile_get_tree_matches_url: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | "https://www.geni.com/api/$_[1]/tree-matches?only_ids=true"; | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | # Will merge two profiles together if you have permission, or it will create a | ||||||||||||||||||||||||||||||||||||||||||
| 93 | # requested merge if you don’t have edit permission on both profiles. | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub _profile_do_merge_url($$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_profile_do_merge_url: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | "https://www.geni.com/api/$_[1]/merge/$_[2]?only_ids=true"; | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | # Project APIs | ||||||||||||||||||||||||||||||||||||||||||
| 98 | # Returns a list of users collaborating on a project. | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | sub _project_get_collaborators_url($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_project_get_collaborators_url: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | "https://www.geni.com/api/project-$_[1]/collaborators?only_ids=true"; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | # Returns a list of profiles tagged in a project. | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub _project_profiles_url($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_project_profiles_url: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | "https://www.geni.com/api/project-$_[1]/profiles?only_ids=true"; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | # Returns a list of users following a project. | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | sub _project_get_followers_url($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_project_get_followers_url: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | "https://www.geni.com/api/project-$_[1]/followers?only_ids=true"; | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub _check_public_url($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_public_url: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | "https://www.geni.com/api/profile-$_[1]/check-public"; | |||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | sub _get_results($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_results: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my ($self, $url) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my $res = $self->{ua}->get($url); | |||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | if ($res->is_success){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | return $self->{json}->allow_nonref->relaxed->decode($res->decoded_content); | |||||||||||||||||||||||||||||||||||||||||
| 120 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $WWW::Geni::errstr = $res->status_line; | |||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub _post_results($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_post_results: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my ($self, $url) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my $res = $self->{ua}->post($url); | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | if ($res->is_success){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | return $self->{json}->allow_nonref->relaxed->decode($res->decoded_content); | |||||||||||||||||||||||||||||||||||||||||
| 131 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $WWW::Geni::errstr = $res->status_line; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | sub _populate_tree_conflicts($$){ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_populate_tree_conflicts: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my ($self, $list) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 139 | my $j = $self->_get_results( | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | $list->{next_page_url} or $self->_profile_get_tree_conflicts_url(1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$list->{'next_page_url'} || $self->_profile_get_tree_conflicts_url(1)
MC/DC0%0/2
$list->{'next_page_url'} || $self->_profile_get_tree_conflicts_url(1)
$list->{'next_page_url'}
$self->_profile_get_tree_conflicts_url(1)
Truth table0%0/3
A || B
A= $list->{'next_page_url'}B= $self->_profile_get_tree_conflicts_url(1)
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | ) or return 0; | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | foreach(@{$j->{results}}){ | |||||||||||||||||||||||||||||||||||||||||
| 143 | my $c = WWW::Geni::Conflict->new( | ||||||||||||||||||||||||||||||||||||||||||
| 144 | focus => $_->{profile}, | ||||||||||||||||||||||||||||||||||||||||||
| 145 | type => $_->{issue_type}, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | actor => $_->{actor} | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $c->_add_managers(@{$_->{managers}}); | |||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $list->add($c); | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $list->{cur_page_num} = $j->{page}; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $list->{next_page_url} = $j->{next_page}; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | } # end WWW::Geni class | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 158 | # WWW::Geni::Conflict class | ||||||||||||||||||||||||||||||||||||||||||
| 159 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 160 | { | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 2 | package WWW::Geni::Conflict; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 2 | our $VERSION = $WWW::Geni::VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my $self = { @_ }; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $self->{profile} = WWW::Geni::Profile->new(id => $self->{focus}); | |||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $self->{parents} = WWW::Geni::List->new(); | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $self->{siblings} = WWW::Geni::List->new(); | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $self->{spouses} = WWW::Geni::List->new(); | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | $self->{children} = WWW::Geni::List->new(); | |||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $self->{parents}->{type} = "parents"; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $self->{siblings}->{type} = "siblings"; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $self->{spouses}->{type} = "spouses"; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $self->{children}->{type} = "children"; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | sub profile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
profile: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | if (!$self->{resolved}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | $self->_resolve( | ||||||||||||||||||||||||||||||||||||||||||
| 184 | $WWW::Geni::geni->_profile_get_immediate_family_url($self->{focus}) | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | return $self->{profile}; | |||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | sub managers { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
managers: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if (!$self->{resolved}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | $self->_resolve( | ||||||||||||||||||||||||||||||||||||||||||
| 194 | $WWW::Geni::geni->_profile_get_immediate_family_url($self->{focus}) | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my $list = WWW::Geni::List->new(); | |||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | foreach my $id (@{$self->{managers}}){ | |||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $id =~ /^profile-/i | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | ? $list->add(WWW::Geni::Profile->new( id => $id)) | ||||||||||||||||||||||||||||||||||||||||||
| 201 | : $list->add(WWW::Geni::Profile->new( guid => $id)); | ||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | return $list; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | sub type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | return $self->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | sub actor { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
actor: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | return WWW::Geni::Profile->new(id => $self->{actor}); | |||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | sub fetch_list { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch_list: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | if (!$self->{resolved}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $self->_resolve( | |||||||||||||||||||||||||||||||||||||||||
| 220 | $WWW::Geni::geni->_profile_get_immediate_family_url($self->profile()->id()) | ||||||||||||||||||||||||||||||||||||||||||
| 221 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | if ( defined $self->{spouses} && $self->{spouses}->count() > 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/3
defined $self->{"spouses"} and $self->{"spouses"}->count > 0
MC/DC0%0/2
defined $self->{"spouses"} and $self->{"spouses"}->count > 0
defined $self->{"spouses"}
$self->{"spouses"}->count > 0
Truth table0%0/3
A and B
A= defined $self->{"spouses"}B= $self->{"spouses"}->count > 0
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | return delete $self->{spouses}; | |||||||||||||||||||||||||||||||||||||||||
| 225 | ▶ | } elsif ( defined $self->{parents} && $self->{parents}->count() > 0 ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $self->{"parents"} and $self->{"parents"}->count > 0
MC/DC0%0/2
defined $self->{"parents"} and $self->{"parents"}->count > 0
defined $self->{"parents"}
$self->{"parents"}->count > 0
Truth table0%0/3
A and B
A= defined $self->{"parents"}B= $self->{"parents"}->count > 0
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | return delete $self->{parents}; | |||||||||||||||||||||||||||||||||||||||||
| 227 | ▶ | } elsif ( defined $self->{children} && $self->{children}->count() > 0 ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $self->{"children"} and $self->{"children"}->count > 0
MC/DC0%0/2
defined $self->{"children"} and $self->{"children"}->count > 0
defined $self->{"children"}
$self->{"children"}->count > 0
Truth table0%0/3
A and B
A= defined $self->{"children"}B= $self->{"children"}->count > 0
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | return delete $self->{children}; | |||||||||||||||||||||||||||||||||||||||||
| 229 | ▶ | } elsif ( defined $self->{siblings} && $self->{siblings}->count() > 0 ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $self->{"siblings"} and $self->{"siblings"}->count > 0
MC/DC0%0/2
defined $self->{"siblings"} and $self->{"siblings"}->count > 0
defined $self->{"siblings"}
$self->{"siblings"}->count > 0
Truth table0%0/3
A and B
A= defined $self->{"siblings"}B= $self->{"siblings"}->count > 0
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | return delete $self->{siblings}; | |||||||||||||||||||||||||||||||||||||||||
| 231 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | sub _resolve($){ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_resolve: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $url = shift; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my (%temp_edges, $temp_profile); | |||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | my $j = $WWW::Geni::geni->_get_results($url) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | or return 0; | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my @managers = delete @{$j->{focus}->{managers}}[0..5000]; | |||||||||||||||||||||||||||||||||||||||||
| 244 | $self->{profile} = WWW::Geni::Profile->new( | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | map { $_, ${$j->{focus}}{$_} } keys %{$j->{focus}}); | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $self->{profile}->_add_managers(@managers); | |||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | foreach my $nodetype (keys %{$j->{nodes}}) { | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if ($nodetype =~ /union-(\d+)/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | foreach my $member (keys %{$j->{nodes}->{$nodetype}->{edges}}){ | |||||||||||||||||||||||||||||||||||||||||
| 250 | # if the focal profile is listed as a child in this union | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if (defined ${$j->{nodes}->{$nodetype}->{edges}->{ $self->{profile}->id() }}{"rel"} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} and do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} eq "child"
MC/DC0%0/2
defined do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} and do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} eq "child"
defined do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"}
do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} eq "child"
Truth table0%0/3
A and B
A= defined do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"}B= do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} eq "child"
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ${$j->{nodes}->{$nodetype}->{edges}->{ $self->{profile}->id() }}{"rel"} eq "child"){ | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | # if the current profile is a child, we've found a sibling or duplicate of our focal profile | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | if (${$j->{nodes}->{$nodetype}->{edges}->{$member}}{"rel"} eq "child") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | %temp_edges = %{$j->{nodes}->{$member}->{edges}}; | |||||||||||||||||||||||||||||||||||||||||
| 257 | $temp_profile = WWW::Geni::Profile->new( | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | map { $_, ${$j->{nodes}->{$member}}{$_} } keys %{$j->{nodes}->{$member}}); | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | %{$temp_profile->{edges}} = %temp_edges; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $self->{siblings}->add($temp_profile); | |||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | # if the current profile is a child, we've found a parent of our focal profile | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | }elsif (${$j->{nodes}->{$nodetype}->{edges}->{$member}}{"rel"} eq "partner") { | |||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | %temp_edges = %{$j->{nodes}->{$member}->{edges}}; | |||||||||||||||||||||||||||||||||||||||||
| 265 | $temp_profile = WWW::Geni::Profile->new( | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | map { $_, ${$j->{nodes}->{$member}}{$_} } keys %{$j->{nodes}->{$member}}); | |||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | %{$temp_profile->{edges}} = %temp_edges; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $self->{parents}->add($temp_profile); | |||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | # if the focal profile is listed as a partner in this union | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | } elsif (defined ${$j->{nodes}->{$nodetype}->{edges}->{ $self->{profile}->id() }}{"rel"} && | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} and do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} eq "partner"
MC/DC0%0/2
defined do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} and do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} eq "partner"
defined do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"}
do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} eq "partner"
Truth table0%0/3
A and B
A= defined do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"}B= do {
$j->{"nodes"}{$nodetype}{"edges"}{$self->{"profile"}->id}
}->{"rel"} eq "partner"
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ${$j->{nodes}->{$nodetype}->{edges}->{ $self->{profile}->id() }}{"rel"} eq "partner"){ | |||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | # if the current profile is a child, we've found a child of our focal profile | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | if (${$j->{nodes}->{$nodetype}->{edges}->{$member}}{"rel"} eq "child") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | %temp_edges = %{$j->{nodes}->{$member}->{edges}}; | |||||||||||||||||||||||||||||||||||||||||
| 278 | $temp_profile = WWW::Geni::Profile->new( | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | map { $_, ${$j->{nodes}->{$member}}{$_} } keys %{$j->{nodes}->{$member}}); | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | %{$temp_profile->{edges}} = %temp_edges; | |||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $self->{children}->add($temp_profile); | |||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | # if the current profile is a child, we've found a spouse or duplicate of our focal profile | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | }elsif (${$j->{nodes}->{$nodetype}->{edges}->{$member}}{"rel"} eq "partner") { | |||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | %temp_edges = %{$j->{nodes}->{$member}->{edges}}; | |||||||||||||||||||||||||||||||||||||||||
| 286 | $temp_profile = WWW::Geni::Profile->new( | ||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | map { $_, ${$j->{nodes}->{$member}}{$_} } keys %{$j->{nodes}->{$member}}); | |||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | %{$temp_profile->{edges}} = %temp_edges; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | $self->{spouses}->add($temp_profile); | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $self->{resolved} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | sub _add_managers { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_managers: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | push @{$self->{managers}}, @_; | |||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | } # end WWW::Geni::Conflict class | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 308 | # WWW::Geni::Profile class | ||||||||||||||||||||||||||||||||||||||||||
| 309 | # managers (array), big_tree (true, false), first_name, middle_name, last_name | ||||||||||||||||||||||||||||||||||||||||||
| 310 | # maiden_name, birth_date, birth_location, death_date, death_location, gender, | ||||||||||||||||||||||||||||||||||||||||||
| 311 | # url, public, locked (true, false), created_by, guid, name, id | ||||||||||||||||||||||||||||||||||||||||||
| 312 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 313 | { | ||||||||||||||||||||||||||||||||||||||||||
| 314 | 2 | package WWW::Geni::Profile; | |||||||||||||||||||||||||||||||||||||||||
| 315 | 2 | our $VERSION = $WWW::Geni::VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $self; | |||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $self = { @_ }; | |||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 322 | # TODO: Do this if the current user is a curator | ||||||||||||||||||||||||||||||||||||||||||
| 323 | #if (defined $self->{public} && $self->{public} eq "false") { | ||||||||||||||||||||||||||||||||||||||||||
| 324 | # $self->_check_public(); | ||||||||||||||||||||||||||||||||||||||||||
| 325 | #} | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub id { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
id: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | return $self->{id} ? $self->{id} : $self->{guid}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | sub first_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
first_name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | return $self->{first_name}; | |||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | sub middle_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
middle_name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | return $self->{middle_name}; | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | sub last_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
last_name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | return $self->{last_name}; | |||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | sub maiden_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
maiden_name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | return $self->{maiden_name}; | |||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | sub display_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
display_name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | return $self->{name}; | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | sub birth_date { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
birth_date: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | return $self->{birth_date}; | |||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | sub birth_location { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
birth_location: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | return $self->{birth_location}; | |||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | sub death_date { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
death_date: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | return $self->{death_date}; | |||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | sub death_location{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
death_location: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | return $self->{death_location}; | |||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | sub locked { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
locked: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | return $self->{locked}; | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | sub big_tree { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
big_tree: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | return ($self->{big_tree} =~ /true/i); | |||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | sub claimed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
claimed: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | return ($self->{claimed} =~ /true/i); | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | sub public { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
public: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | return ($self->{public} =~ /true/i); | |||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | sub gender { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gender: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | return $self->{first_name}; | |||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | sub creator { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
creator: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | return WWW::Geni::Profile->new(id => $self->{created_by}); | |||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | sub guid { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
guid: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | return $self->{guid}; | |||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | sub managers { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
managers: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | return $self->{managers}; | |||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | sub _add_managers { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_managers: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | push @{$self->{managers}}, @_; | |||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | sub _check_public { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_public: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | if (defined $WWW::Geni::geni && defined $self->{public} && $self->{public} eq "false") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $WWW::Geni::geni and defined $self->{"public"} and $self->{"public"} eq "false"
defined $WWW::Geni::geni and defined $self->{"public"}
MC/DC0%0/3
defined $WWW::Geni::geni and defined $self->{"public"} and $self->{"public"} eq "false"
defined $WWW::Geni::geni
defined $self->{"public"}
$self->{"public"} eq "false"
Truth table0%0/4
A and B and C
A= defined $WWW::Geni::geniB= defined $self->{"public"}C= $self->{"public"} eq "false"
| |||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | my $j = $WWW::Geni::geni->_post_results($WWW::Geni::geni->_check_public_url($self->id())); | |||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | return $j->{public} =~ /true/i; | |||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | } # end WWW::Geni::Profile class | ||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 436 | # WWW::Geni::Family class | ||||||||||||||||||||||||||||||||||||||||||
| 437 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 438 | { | ||||||||||||||||||||||||||||||||||||||||||
| 439 | 2 | package WWW::Geni::Family; | |||||||||||||||||||||||||||||||||||||||||
| 440 | 2 | our $VERSION = $WWW::Geni::VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | my $self = { @_ }; | |||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | sub add { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | if ((shift) == "child"){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | push @{$self->{children}}, (shift); | |||||||||||||||||||||||||||||||||||||||||
| 453 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | push @{$self->{parents}}, (shift); | |||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | sub focus { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
focus: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | return $self->{focus}; | |||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | sub parents { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parents: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | return @{$self->{parents}}; | |||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | sub children { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
children: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | return @{$self->{childred}}; | |||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | } # end WWW::Geni::Family class | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 476 | # WWW::Geni::List class | ||||||||||||||||||||||||||||||||||||||||||
| 477 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 478 | { | ||||||||||||||||||||||||||||||||||||||||||
| 479 | 2 | package WWW::Geni::List; | |||||||||||||||||||||||||||||||||||||||||
| 480 | 2 | our $VERSION = $WWW::Geni::VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | @{$self->{items}} = @_; | |||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | sub get_next { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_next: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | if ($self->count() == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | if(${$self->{items}}[0] && ref(${$self->{items}}[0]) eq "WWW::Geni::Conflict"){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
do {
$$self{"items"}
}->[0] and ref do {
$$self{"items"}
}->[0] eq "WWW::Geni::Conflict"
MC/DC0%0/2
do {
$$self{"items"}
}->[0] and ref do {
$$self{"items"}
}->[0] eq "WWW::Geni::Conflict"
do {
$$self{"items"}
}->[0]
ref do {
$$self{"items"}
}->[0] eq "WWW::Geni::Conflict"
Truth table0%0/3
A and B
A= do {
$$self{"items"}
}->[0]B= ref do {
$$self{"items"}
}->[0] eq "WWW::Geni::Conflict"
| |||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | $WWW::Geni::geni->_populate_tree_conflicts($self); | |||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | return shift @{$self->{items}}; | |||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | ▶ | sub has_next { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_next: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | return $#{$self->{items}} > 0; | |||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | sub add { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | push @{$self->{items}}, @_; | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | ▶ | sub count { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
count: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | return $#{$self->{items}}; | |||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | } # end WWW::Geni::List class | ||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 519 | __END__ | ||||||||||||||||||||||||||||||||||||||||||