| 1 | # $Id: WebStats.pm,v 1.9 2003/10/10 01:57:57 vek Exp $ | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | package SETI::WebStats; | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 3 | ▶ | use Carp qw(croak); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 3 | ▶ | use LWP::UserAgent; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 3 | ▶ | use XML::Simple; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 3 | ▶ | use vars qw($VERSION); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 3 | $VERSION = '1.03'; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 3 | ▶ | use constant USERURL => | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 3 | "http://setiathome.ssl.berkeley.edu/fcgi-bin/fcgi?cmd=user_xml&email=%s"; | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 3 | ▶ | use constant GROUPURL => | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | 3 | "http://setiathome.ssl.berkeley.edu/fcgi-bin/fcgi?cmd=team_lookup_xml&name=%s"; | |||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 2 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||
| 20 | 2 | my ($class, $emailAddr) = @_; | |||||||||||||||||||
| 21 | 2 | my $self = {}; | |||||||||||||||||||
| 22 | 2 | $self->{version} = $VERSION; | |||||||||||||||||||
| 23 | 2 | bless $self, $class; | |||||||||||||||||||
| 24 | # still allowing emailAddr in constructor for | ||||||||||||||||||||
| 25 | # backwards compatability... | ||||||||||||||||||||
| 26 | 2 | ▶ | if ($emailAddr) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 27 | 0 | return $self->fetchUserStats($emailAddr); | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | 2 | return $self; | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | ############################################################################### | ||||||||||||||||||||
| 33 | # Public methods | ||||||||||||||||||||
| 34 | ############################################################################### | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 1 | ▶ | sub fetchUserStats { | ||||||||||||||||||
|
Subroutine
fetchUserStats: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||
| 37 | 1 | my ($self, $emailAddr) = @_; | |||||||||||||||||||
| 38 | 1 | ▶ | if (! $emailAddr) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 39 | 0 | croak("You must specify an email address"); | |||||||||||||||||||
| 40 | 0 | return 0; | |||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | 1 | my $url = sprintf(USERURL, $emailAddr); | |||||||||||||||||||
| 43 | 1 | $self->_mode('user'); | |||||||||||||||||||
| 44 | 1 | return $self->_fetch($url); | |||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 1 | ▶ | sub fetchGroupStats { | ||||||||||||||||||
|
Subroutine
fetchGroupStats: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||
| 48 | 1 | my ($self, $groupName) = @_; | |||||||||||||||||||
| 49 | 1 | ▶ | if (! $groupName) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 50 | 0 | croak("You must specify a group name"); | |||||||||||||||||||
| 51 | 0 | return 0; | |||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | 1 | my $url = sprintf(GROUPURL, $groupName); | |||||||||||||||||||
| 54 | 1 | $self->_mode('group'); | |||||||||||||||||||
| 55 | 1 | return $self->_fetch($url); | |||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | # userinfo methods | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 1 | ▶ | sub userInfo { | ||||||||||||||||||
|
Subroutine
userInfo: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 61 | 1 | my $self = shift; | |||||||||||||||||||
| 62 | 1 | return $self->{data}->{userinfo}; | |||||||||||||||||||
| 63 | } | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 1 | ▶ | sub userTime { | ||||||||||||||||||
|
Subroutine
userTime: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 66 | 1 | my $self = shift; | |||||||||||||||||||
| 67 | 1 | return $self->{data}->{userinfo}->{usertime}; | |||||||||||||||||||
| 68 | } | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 1 | ▶ | sub aveCpu { | ||||||||||||||||||
|
Subroutine
aveCpu: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 71 | 1 | my $self = shift; | |||||||||||||||||||
| 72 | 1 | return $self->{data}->{userinfo}->{avecpu}; | |||||||||||||||||||
| 73 | } | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 1 | ▶ | sub numResults { | ||||||||||||||||||
|
Subroutine
numResults: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 76 | 1 | my $self = shift; | |||||||||||||||||||
| 77 | 1 | return $self->{data}->{userinfo}->{numresults}; | |||||||||||||||||||
| 78 | } | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | 1 | ▶ | sub regDate { | ||||||||||||||||||
|
Subroutine
regDate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 81 | 1 | my $self = shift; | |||||||||||||||||||
| 82 | 1 | return $self->{data}->{userinfo}->{regdate}; | |||||||||||||||||||
| 83 | } | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | 1 | ▶ | sub profileURL { | ||||||||||||||||||
|
Subroutine
profileURL: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||
| 86 | 1 | my $self = shift; | |||||||||||||||||||
| 87 | 1 | ▶ | if ($self->{data}->{userinfo}->{userprofile}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 88 | 0 | return $self->{data}->{userinfo}->{userprofile}->{a}->{href}; | |||||||||||||||||||
| 89 | } else { | ||||||||||||||||||||
| 90 | 1 | return "No URL"; | |||||||||||||||||||
| 91 | } | ||||||||||||||||||||
| 92 | } | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | 1 | ▶ | sub resultsPerDay { | ||||||||||||||||||
|
Subroutine
resultsPerDay: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 95 | 1 | my $self = shift; | |||||||||||||||||||
| 96 | 1 | return $self->{data}->{userinfo}->{resultsperday}; | |||||||||||||||||||
| 97 | } | ||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | 1 | ▶ | sub lastResultTime { | ||||||||||||||||||
|
Subroutine
lastResultTime: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 100 | 1 | my $self = shift; | |||||||||||||||||||
| 101 | 1 | ▶ | return $self->{data}->{userinfo}->{lastresulttime} || 0; | ||||||||||||||||||
|
Condition50%1/2
$self->{'data'}{'userinfo'}{'lastresulttime'} || 0
MC/DC0%0/1
$self->{'data'}{'userinfo'}{'lastresulttime'} || 0
$self->{'data'}{'userinfo'}{'lastresulttime'}
Truth table50%1/2
A
A= $self->{'data'}{'userinfo'}{'lastresulttime'}
| |||||||||||||||||||||
| 102 | } | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | 1 | ▶ | sub cpuTime { | ||||||||||||||||||
|
Subroutine
cpuTime: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 105 | 1 | my $self = shift; | |||||||||||||||||||
| 106 | 1 | return $self->{data}->{userinfo}->{cputime}; | |||||||||||||||||||
| 107 | } | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | 1 | ▶ | sub name { | ||||||||||||||||||
|
Subroutine
name: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||
| 110 | 1 | my $self = shift; | |||||||||||||||||||
| 111 | 1 | ▶ | if (ref $self->{data}->{userinfo}->{name}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 112 | 0 | return $self->{data}->{userinfo}->{name}->{a}->{content}; | |||||||||||||||||||
| 113 | } else { | ||||||||||||||||||||
| 114 | 1 | return $self->{data}->{userinfo}->{name}; | |||||||||||||||||||
| 115 | } | ||||||||||||||||||||
| 116 | } | ||||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | 1 | ▶ | sub homePage { | ||||||||||||||||||
|
Subroutine
homePage: called CC=3 SCAR=16.0
Pod
undocumented
| |||||||||||||||||||||
| 119 | 1 | my $self = shift; | |||||||||||||||||||
| 120 | 1 | ▶ | if (ref $self->{data}->{userinfo}->{name}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 121 | 0 | ▶ | if ($self->{data}->{userinfo}->{name}->{a}->{href}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 122 | 0 | return $self->{data}->{userinfo}->{name}->{a}->{href}; | |||||||||||||||||||
| 123 | } else { | ||||||||||||||||||||
| 124 | 0 | return "No Home Page"; | |||||||||||||||||||
| 125 | } | ||||||||||||||||||||
| 126 | } else { | ||||||||||||||||||||
| 127 | 1 | return "No Home Page"; | |||||||||||||||||||
| 128 | } | ||||||||||||||||||||
| 129 | } | ||||||||||||||||||||
| 130 | |||||||||||||||||||||
| 131 | # rankinfo methods | ||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | 1 | ▶ | sub rankInfo { | ||||||||||||||||||
|
Subroutine
rankInfo: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 134 | 1 | my $self = shift; | |||||||||||||||||||
| 135 | 1 | return $self->{data}->{rankinfo}; | |||||||||||||||||||
| 136 | } | ||||||||||||||||||||
| 137 | |||||||||||||||||||||
| 138 | 1 | ▶ | sub haveSameRank { | ||||||||||||||||||
|
Subroutine
haveSameRank: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 139 | 1 | my $self = shift; | |||||||||||||||||||
| 140 | 1 | return $self->{data}->{rankinfo}->{num_samerank}; | |||||||||||||||||||
| 141 | } | ||||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | 1 | ▶ | sub totalUsers { | ||||||||||||||||||
|
Subroutine
totalUsers: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 144 | 1 | my $self = shift; | |||||||||||||||||||
| 145 | 1 | return $self->{data}->{rankinfo}->{ranktotalusers}; | |||||||||||||||||||
| 146 | } | ||||||||||||||||||||
| 147 | |||||||||||||||||||||
| 148 | 1 | ▶ | sub rankPercent { | ||||||||||||||||||
|
Subroutine
rankPercent: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 149 | 1 | my $self = shift; | |||||||||||||||||||
| 150 | 1 | return (100 - $self->{data}->{rankinfo}->{top_rankpct}); | |||||||||||||||||||
| 151 | } | ||||||||||||||||||||
| 152 | |||||||||||||||||||||
| 153 | 1 | ▶ | sub rank { | ||||||||||||||||||
|
Subroutine
rank: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 154 | 1 | my $self = shift; | |||||||||||||||||||
| 155 | 1 | return $self->{data}->{rankinfo}->{rank}; | |||||||||||||||||||
| 156 | } | ||||||||||||||||||||
| 157 | |||||||||||||||||||||
| 158 | # groupinfo methods from individual user query... | ||||||||||||||||||||
| 159 | |||||||||||||||||||||
| 160 | 1 | ▶ | sub groupInfo { | ||||||||||||||||||
|
Subroutine
groupInfo: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 161 | 1 | my $self = shift; | |||||||||||||||||||
| 162 | return $self->{data}->{groupinfo}->{group} ? | ||||||||||||||||||||
| 163 | $self->{data}->{groupinfo}->{group}->{a} : | ||||||||||||||||||||
| 164 | 1 | ▶ | undef; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 165 | } | ||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | 1 | ▶ | sub groupName { | ||||||||||||||||||
|
Subroutine
groupName: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 168 | 1 | my $self = shift; | |||||||||||||||||||
| 169 | return $self->{data}->{groupinfo}->{group} ? | ||||||||||||||||||||
| 170 | $self->{data}->{groupinfo}->{group}->{a}->{content} : | ||||||||||||||||||||
| 171 | 1 | ▶ | undef; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 172 | } | ||||||||||||||||||||
| 173 | |||||||||||||||||||||
| 174 | 1 | ▶ | sub groupUrl { | ||||||||||||||||||
|
Subroutine
groupUrl: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 175 | 1 | my $self = shift; | |||||||||||||||||||
| 176 | return $self->{data}->{groupinfo}->{group} ? | ||||||||||||||||||||
| 177 | $self->{data}->{groupinfo}->{group}->{a}->{href} : | ||||||||||||||||||||
| 178 | 1 | ▶ | undef; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 179 | } | ||||||||||||||||||||
| 180 | |||||||||||||||||||||
| 181 | # group methods (from group query) | ||||||||||||||||||||
| 182 | |||||||||||||||||||||
| 183 | 1 | ▶ | sub groupURL { | ||||||||||||||||||
|
Subroutine
groupURL: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||
| 184 | 1 | my $self = shift; | |||||||||||||||||||
| 185 | return $self->{groupdata} ? | ||||||||||||||||||||
| 186 | 1 | ▶ | ($self->{groupdata}->{url} || undef) : | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"groupdata"}{"url"} or undef
MC/DC0%0/1
$self->{"groupdata"}{"url"} or undef
$self->{"groupdata"}{"url"}
Truth table0%0/2
A
A= $self->{"groupdata"}{"url"}
| |||||||||||||||||||||
| 187 | undef; | ||||||||||||||||||||
| 188 | } | ||||||||||||||||||||
| 189 | |||||||||||||||||||||
| 190 | 1 | ▶ | sub numGroupResults { | ||||||||||||||||||
|
Subroutine
numGroupResults: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||
| 191 | 1 | my $self = shift; | |||||||||||||||||||
| 192 | return $self->{groupdata} ? | ||||||||||||||||||||
| 193 | 1 | ▶ | ($self->{groupdata}->{numresults} || undef) : | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"groupdata"}{"numresults"} or undef
MC/DC0%0/1
$self->{"groupdata"}{"numresults"} or undef
$self->{"groupdata"}{"numresults"}
Truth table0%0/2
A
A= $self->{"groupdata"}{"numresults"}
| |||||||||||||||||||||
| 194 | undef; | ||||||||||||||||||||
| 195 | } | ||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | 1 | ▶ | sub numGroupMembers { | ||||||||||||||||||
|
Subroutine
numGroupMembers: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||
| 198 | 1 | my $self = shift; | |||||||||||||||||||
| 199 | return $self->{groupdata} ? | ||||||||||||||||||||
| 200 | 1 | ▶ | ($self->{groupdata}->{nummembers} || undef) : | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"groupdata"}{"nummembers"} or undef
MC/DC0%0/1
$self->{"groupdata"}{"nummembers"} or undef
$self->{"groupdata"}{"nummembers"}
Truth table0%0/2
A
A= $self->{"groupdata"}{"nummembers"}
| |||||||||||||||||||||
| 201 | undef; | ||||||||||||||||||||
| 202 | } | ||||||||||||||||||||
| 203 | |||||||||||||||||||||
| 204 | 1 | ▶ | sub totalGroupCPU { | ||||||||||||||||||
|
Subroutine
totalGroupCPU: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||
| 205 | 1 | my $self = shift; | |||||||||||||||||||
| 206 | return $self->{groupdata} ? | ||||||||||||||||||||
| 207 | 1 | ▶ | ($self->{groupdata}->{totalcpu} || undef) : | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"groupdata"}{"totalcpu"} or undef
MC/DC0%0/1
$self->{"groupdata"}{"totalcpu"} or undef
$self->{"groupdata"}{"totalcpu"}
Truth table0%0/2
A
A= $self->{"groupdata"}{"totalcpu"}
| |||||||||||||||||||||
| 208 | undef; | ||||||||||||||||||||
| 209 | } | ||||||||||||||||||||
| 210 | |||||||||||||||||||||
| 211 | 1 | ▶ | sub nameOfGroup { | ||||||||||||||||||
|
Subroutine
nameOfGroup: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||
| 212 | 1 | my $self = shift; | |||||||||||||||||||
| 213 | return $self->{groupdata} ? | ||||||||||||||||||||
| 214 | 1 | ▶ | ($self->{groupdata}->{name} || undef) : | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"groupdata"}{"name"} or undef
MC/DC0%0/1
$self->{"groupdata"}{"name"} or undef
$self->{"groupdata"}{"name"}
Truth table0%0/2
A
A= $self->{"groupdata"}{"name"}
| |||||||||||||||||||||
| 215 | undef; | ||||||||||||||||||||
| 216 | } | ||||||||||||||||||||
| 217 | |||||||||||||||||||||
| 218 | 1 | ▶ | sub groupFounderName { | ||||||||||||||||||
|
Subroutine
groupFounderName: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||
| 219 | 1 | my $self = shift; | |||||||||||||||||||
| 220 | return $self->{groupdata} ? | ||||||||||||||||||||
| 221 | 1 | ▶ | ($self->{groupdata}->{founder}->{name} || undef) : | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"groupdata"}{"founder"}{"name"} or undef
MC/DC0%0/1
$self->{"groupdata"}{"founder"}{"name"} or undef
$self->{"groupdata"}{"founder"}{"name"}
Truth table0%0/2
A
A= $self->{"groupdata"}{"founder"}{"name"}
| |||||||||||||||||||||
| 222 | undef; | ||||||||||||||||||||
| 223 | } | ||||||||||||||||||||
| 224 | |||||||||||||||||||||
| 225 | 1 | ▶ | sub groupFounderURL { | ||||||||||||||||||
|
Subroutine
groupFounderURL: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||
| 226 | 1 | my $self = shift; | |||||||||||||||||||
| 227 | return $self->{groupdata} ? | ||||||||||||||||||||
| 228 | 1 | ▶ | ($self->{groupdata}->{founder}->{url} || undef) : | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"groupdata"}{"founder"}{"url"} or undef
MC/DC0%0/1
$self->{"groupdata"}{"founder"}{"url"} or undef
$self->{"groupdata"}{"founder"}{"url"}
Truth table0%0/2
A
A= $self->{"groupdata"}{"founder"}{"url"}
| |||||||||||||||||||||
| 229 | undef; | ||||||||||||||||||||
| 230 | } | ||||||||||||||||||||
| 231 | |||||||||||||||||||||
| 232 | ############################################################################### | ||||||||||||||||||||
| 233 | # Private methods | ||||||||||||||||||||
| 234 | ############################################################################### | ||||||||||||||||||||
| 235 | |||||||||||||||||||||
| 236 | 2 | ▶ | sub _fetch { | ||||||||||||||||||
|
Subroutine
_fetch: called CC=4 SCAR=21.7
| |||||||||||||||||||||
| 237 | 2 | my ($self, $URL) = @_; | |||||||||||||||||||
| 238 | 2 | my $ua = LWP::UserAgent->new; | |||||||||||||||||||
| 239 | 2 | $ua->agent("SETI::WebStats/$VERSION " . $ua->agent); | |||||||||||||||||||
| 240 | 2 | my $req = HTTP::Request->new('GET', $URL); | |||||||||||||||||||
| 241 | 2 | my $resp = $ua->request($req); | |||||||||||||||||||
| 242 | 2 | ▶ | return 0 if (! $resp->is_success); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 243 | 0 | ▶ | if ($resp->content =~ /No user|No such group/) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 244 | 0 | croak($resp->content); | |||||||||||||||||||
| 245 | 0 | return 0; | |||||||||||||||||||
| 246 | } | ||||||||||||||||||||
| 247 | 0 | local ($^W) = 0; # silence XML::SAX::Expat | |||||||||||||||||||
| 248 | 0 | ▶ | if ($self->_mode eq 'user') { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 249 | 0 | $self->{data} = XMLin($resp->content); | |||||||||||||||||||
| 250 | } else { | ||||||||||||||||||||
| 251 | 0 | $self->{groupdata} = XMLin($resp->content); | |||||||||||||||||||
| 252 | } | ||||||||||||||||||||
| 253 | 0 | local ($^W) = 1; | |||||||||||||||||||
| 254 | 0 | return 1; | |||||||||||||||||||
| 255 | } | ||||||||||||||||||||
| 256 | |||||||||||||||||||||
| 257 | 2 | ▶ | sub _mode { | ||||||||||||||||||
|
Subroutine
_mode: called CC=3 SCAR=13.3
| |||||||||||||||||||||
| 258 | 2 | my ($self, $mode) = @_; | |||||||||||||||||||
| 259 | 2 | ▶ | if (defined $mode) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 260 | 2 | $self->{mode} = $mode; | |||||||||||||||||||
| 261 | 2 | return $self; | |||||||||||||||||||
| 262 | } else { | ||||||||||||||||||||
| 263 | 0 | ▶ | return $self->{mode} || undef; | ||||||||||||||||||
|
Condition0%0/2
$self->{'mode'} || undef
MC/DC0%0/1
$self->{'mode'} || undef
$self->{'mode'}
Truth table0%0/2
A
A= $self->{'mode'}
| |||||||||||||||||||||
| 264 | } | ||||||||||||||||||||
| 265 | } | ||||||||||||||||||||
| 266 | |||||||||||||||||||||
| 267 | 3 | 1; | |||||||||||||||||||
| 268 | __END__ | ||||||||||||||||||||