| 1 | package ProjectBuilder::Log; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # this class can be used to store and analyze the complete log from pb | ||||||||||||||||||||||||||||
| 4 | # this includes more than one vm | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use ProjectBuilder::Version; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use ProjectBuilder::Base; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use ProjectBuilder::Log::Item; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub new { | ||||||||||||||||||||||||||||
| 12 | # contains the object name (here PBLog) | ||||||||||||||||||||||||||||
| 13 | 0 | ▶ | my $object = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 0 | my $self = {}; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | # $self should point to an object of type $object | ||||||||||||||||||||||||||||
| 17 | 0 | bless($self, $object); | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | # this array stores our childs | ||||||||||||||||||||||||||||
| 20 | 0 | $self->{'logitems'} = []; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | return($self); | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | # returns number of handled ProjectBuilder::Log::Item's | ||||||||||||||||||||||||||||
| 26 | sub countItems { | ||||||||||||||||||||||||||||
| 27 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
countItems: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 0 | return scalar(@{$self->{'logitems'}}); | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | # returns an array of all names of handled ProjectBuilder::Log::Item's | ||||||||||||||||||||||||||||
| 32 | # the name is the vm name (e.g. ubuntu-10.04-i386 (by default)) | ||||||||||||||||||||||||||||
| 33 | sub itemNames { | ||||||||||||||||||||||||||||
| 34 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
itemNames: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 0 | my @result = (); | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | foreach my $item (@{$self->{'logitems'}}) { | |||||||||||||||||||||||||||
| 38 | 0 | push(@result, $item->name()); | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | 0 | return @result; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | # set's the log for ProjectBuilder::Log::item $vmname | ||||||||||||||||||||||||||||
| 44 | # if such an item is not present, one is added | ||||||||||||||||||||||||||||
| 45 | # $log should only contain the log of one machine | ||||||||||||||||||||||||||||
| 46 | sub setLog { | ||||||||||||||||||||||||||||
| 47 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
setLog: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 48 | 0 | my $vmname = shift; | |||||||||||||||||||||||||||
| 49 | 0 | my $log = shift; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | my $logitem = $self->findItem($vmname); | |||||||||||||||||||||||||||
| 52 | 0 | ▶ | if (!$logitem) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 0 | $logitem = new ProjectBuilder::Log::Item($vmname); | |||||||||||||||||||||||||||
| 54 | 0 | push(@{$self->{'logitems'}}, $logitem); | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | 0 | $logitem->setLog($log); | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | # used to analyze the complete log of pb | ||||||||||||||||||||||||||||
| 60 | sub setCompleteLog { | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
setCompleteLog: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 62 | 0 | my $log = shift; | |||||||||||||||||||||||||||
| 63 | 0 | my $tmplog = ""; | |||||||||||||||||||||||||||
| 64 | 0 | my $item = undef; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | foreach my $line (split("\n", $log)) { | |||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ($line =~ m/^Waiting [0-9]+ s for VM/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | # here starts a new machine, so append the tmplog to the last one | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if (defined($item)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | $item->setLog($tmplog); | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if($line =~ m/VM ([^\s]+)/){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 0 | $item = new ProjectBuilder::Log::Item($1); | |||||||||||||||||||||||||||
| 74 | 0 | push(@{$self->{'logitems'}}, $item); | |||||||||||||||||||||||||||
| 75 | 0 | $tmplog = 0; | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | } else { | ||||||||||||||||||||||||||||
| 78 | 0 | $tmplog .= $line ."\n"; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | 0 | ▶ | if (defined($item) && ($tmplog)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $item and $tmplog
MC/DC0%0/2
defined $item and $tmplog
defined $item
$tmplog
Truth table0%0/3
A and B
A= defined $itemB= $tmplog
| |||||||||||||||||||||||||||||
| 82 | 0 | $item->setLog($tmplog); | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | # nums the issues (Warnings and Errors from lintian and rpmlint | ||||||||||||||||||||||||||||
| 87 | # if no name is given, the total of all ProjectBuilder::Log::Item's is returned | ||||||||||||||||||||||||||||
| 88 | sub numQaIssues { | ||||||||||||||||||||||||||||
| 89 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
numQaIssues: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 90 | 0 | ▶ | my $itemname = shift || ""; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 91 | 0 | my $result = 0; | |||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | if ($itemname eq "") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | # no machine selected, so return combine from all items | ||||||||||||||||||||||||||||
| 95 | 0 | foreach my $item (@{$self->{'logitems'}}) { | |||||||||||||||||||||||||||
| 96 | 0 | $result += scalar($item->qaIssues()); | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | } else { | ||||||||||||||||||||||||||||
| 99 | 0 | my $item = $self->findItem($itemname); | |||||||||||||||||||||||||||
| 100 | 0 | ▶ | if ($item) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | 0 | $result = $item->numQaIssues(); | |||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | 0 | return $result; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | # returns the issues itself | ||||||||||||||||||||||||||||
| 108 | # behaves like numQaIssues | ||||||||||||||||||||||||||||
| 109 | sub qaIssues { | ||||||||||||||||||||||||||||
| 110 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
qaIssues: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $itemname = shift || ""; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 112 | 0 | my @result = (); | |||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 0 | ▶ | if ($itemname eq "") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | # no machine selected, so return combine from all items | ||||||||||||||||||||||||||||
| 116 | 0 | foreach my $item (@{$self->{'logitems'}}) { | |||||||||||||||||||||||||||
| 117 | 0 | push(@result, $item->qaIssues()); | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | } else { | ||||||||||||||||||||||||||||
| 120 | 0 | my $item = $self->findItem($itemname); | |||||||||||||||||||||||||||
| 121 | 0 | ▶ | if ($item) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | 0 | push(@result, $item->qaIssues()); | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | 0 | return @result; | |||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | # same as num qaIssues but for compile errors | ||||||||||||||||||||||||||||
| 129 | sub numErrors { | ||||||||||||||||||||||||||||
| 130 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
numErrors: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 131 | 0 | ▶ | my $itemname = shift || ""; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 132 | 0 | my $result = 0; | |||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ($itemname eq "") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | # no machine selected, so return combine from all items | ||||||||||||||||||||||||||||
| 136 | 0 | foreach my $item (@{$self->{'logitems'}}) { | |||||||||||||||||||||||||||
| 137 | 0 | $result += $item->numErrors(); | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | } else { | ||||||||||||||||||||||||||||
| 140 | 0 | my $item = $self->findItem($itemname); | |||||||||||||||||||||||||||
| 141 | 0 | ▶ | if ($item) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | 0 | $result = $item->numErrors(); | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | 0 | return $result; | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | # returns the compile errors itself | ||||||||||||||||||||||||||||
| 149 | # behaves like numQaIssues | ||||||||||||||||||||||||||||
| 150 | sub errors { | ||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
errors: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 152 | 0 | ▶ | my $itemname = shift || ""; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 153 | 0 | my @result = (); | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ($itemname eq "") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | # no machine selected, so return combine from all items | ||||||||||||||||||||||||||||
| 157 | 0 | foreach my $item (@{$self->{'logitems'}}) { | |||||||||||||||||||||||||||
| 158 | 0 | push(@result, $item->errors()); | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | } else { | ||||||||||||||||||||||||||||
| 161 | 0 | my $item = $self->findItem($itemname); | |||||||||||||||||||||||||||
| 162 | 0 | ▶ | if ($item) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | 0 | push(@result, $item->errors()); | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | 0 | return @result; | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | # same as num qaIssues but for compile warnings | ||||||||||||||||||||||||||||
| 170 | sub numWarnings { | ||||||||||||||||||||||||||||
| 171 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
numWarnings: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 172 | 0 | ▶ | my $itemname = shift || ""; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 173 | 0 | my $result = 0; | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ($itemname eq "") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | # no machine selected, so return combine from all items | ||||||||||||||||||||||||||||
| 177 | 0 | foreach my $item (@{$self->{'logitems'}}) { | |||||||||||||||||||||||||||
| 178 | 0 | $result += $item->numWarnings(); | |||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | } else { | ||||||||||||||||||||||||||||
| 181 | 0 | my $item = $self->findItem($itemname); | |||||||||||||||||||||||||||
| 182 | 0 | ▶ | if ($item) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | 0 | $result = $item->numWarnings(); | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | 0 | return $result; | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | # returns the compile warnings itself | ||||||||||||||||||||||||||||
| 190 | # behaves like numQaIssues | ||||||||||||||||||||||||||||
| 191 | sub warnings { | ||||||||||||||||||||||||||||
| 192 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
warnings: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 193 | 0 | ▶ | my $itemname = shift || ""; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 194 | 0 | my @result = (); | |||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if ($itemname eq "") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | # no machine selected, so return combine from all items | ||||||||||||||||||||||||||||
| 198 | 0 | foreach my $item (@{$self->{'logitems'}}) { | |||||||||||||||||||||||||||
| 199 | 0 | push(@result, $item->warnings()); | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | } else { | ||||||||||||||||||||||||||||
| 202 | 0 | my $item = $self->findItem($itemname); | |||||||||||||||||||||||||||
| 203 | 0 | ▶ | if ($item) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | 0 | push(@result, $item->warnings()); | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | 0 | return @result; | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | # prints out a summary of the log | ||||||||||||||||||||||||||||
| 211 | sub summary { | ||||||||||||||||||||||||||||
| 212 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
summary: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 213 | 0 | my $summary = ""; | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | $summary = "Items: ". $self->countItems(); | |||||||||||||||||||||||||||
| 216 | 0 | $summary .= " (QA Issues: ". $self->numQaIssues(); | |||||||||||||||||||||||||||
| 217 | 0 | $summary .= ", Warnings: ". $self->numWarnings(); | |||||||||||||||||||||||||||
| 218 | 0 | $summary .= ", Errors: ". $self->numErrors() .")\n"; | |||||||||||||||||||||||||||
| 219 | 0 | foreach my $name ($self->itemNames()) { | |||||||||||||||||||||||||||
| 220 | 0 | $summary .= $name ." (QA Issues: ". $self->numQaIssues($name); | |||||||||||||||||||||||||||
| 221 | 0 | $summary .= ", Warnings: ". $self->numWarnings($name); | |||||||||||||||||||||||||||
| 222 | 0 | $summary .= ", Errors: ". $self->numErrors($name) .")\n"; | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | 0 | return $summary; | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | # mails the summary to $to | ||||||||||||||||||||||||||||
| 228 | sub mailSummary { | ||||||||||||||||||||||||||||
| 229 | eval | ||||||||||||||||||||||||||||
| 230 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
mailSummary: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 231 | 0 | require Mail::Sendmail; | |||||||||||||||||||||||||||
| 232 | 0 | Mail::Sendmail->import(); | |||||||||||||||||||||||||||
| 233 | }; | ||||||||||||||||||||||||||||
| 234 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | # Mail::Sendmail not found not sending mail ! | ||||||||||||||||||||||||||||
| 236 | 0 | pb_log(0,"No Mail::Sendmail module found so not sending any mail !\n"); | |||||||||||||||||||||||||||
| 237 | } else { | ||||||||||||||||||||||||||||
| 238 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 239 | 0 | ▶ | my $to = shift || ""; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if ($to eq "") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 242 | 0 | pb_log(0,"Please give a To: address\n"); | |||||||||||||||||||||||||||
| 243 | 0 | return; | |||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | 0 | my %mail = ( | |||||||||||||||||||||||||||
| 246 | To => $to, | ||||||||||||||||||||||||||||
| 247 | From => "pb\@localhost", | ||||||||||||||||||||||||||||
| 248 | Message => $self->summary() | ||||||||||||||||||||||||||||
| 249 | ); | ||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if (! sendmail(%mail)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if (defined $Mail::Sendmail::error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 252 | 0 | return $Mail::Sendmail::error; | |||||||||||||||||||||||||||
| 253 | } else { | ||||||||||||||||||||||||||||
| 254 | 0 | return "Unkown error"; | |||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | 0 | pb_log(0,"Mail send to ". $to ."\n"); | |||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | # private part (perl does not no about private, but it is meant so) | ||||||||||||||||||||||||||||
| 262 | # find's item with name $vmname in handled OB::Log::Item's | ||||||||||||||||||||||||||||
| 263 | sub findItem { | ||||||||||||||||||||||||||||
| 264 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
findItem: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 265 | 0 | my $vmname = shift; | |||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | # find existing item or add item if needed | ||||||||||||||||||||||||||||
| 268 | 0 | foreach my $logitem (@{$self->{'logitems'}}) { | |||||||||||||||||||||||||||
| 269 | 0 | ▶ | if ($logitem->name eq $vmname) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 270 | 0 | return $logitem; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | 0 | return 0; | |||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 1 | 1; | |||||||||||||||||||||||||||