Branch Coverage

blib/lib/IMAP/Client.pm
Criterion Covered Total %
branch 123 516 23.8


line true false branch
161 0 20 unless ($debugbit and not $debugbit & $debugbit - 1)
165 0 20 if ($$self{'DEBUG'} & $debugbit)
178 12 138 $_[$#_] =~ /^$VALID_TAG+?\s*OK\s+/ ? :
181 2 26 $_[$#_] =~ /^\+ / ? :
184 26 13 $_[$#_] =~ /^\* (?!BAD)/ ? :
187 4 24 $_[$#_] =~ /^\*\s*OK\s+/ ? :
190 5 23 $_[$#_] =~ /^(?:$VALID_TAG|\*)+?\s*(BAD|NO)\s+/ ? :
194 0 0 $_[0] =~ /^(?:(?:\d+|\d+\:\d+)(?:\,\d+|\d+\:\d+)*|\d+:\*|\*)$/ ? :
200 10 33 unless $start
201 33 0 if ($start)
202 17 16 if ($end + 1 == $number) { }
205 12 4 $start == $end ? :
210 5 5 $start == $end ? :
219 0 0 if ($$self{'onfail'} eq 'error') { }
0 0 elsif ($$self{'onfail'} eq 'abort') { }
220 0 0 if ($$self{'errorstyle'} eq 'stack' and not $$self{'error_read'}) { }
236 0 0 unless $_[0]
240 0 0 if (ok_response $line) { }
0 0 elsif (($_t, $_v) = $line =~ /(\w+)\s*\((.*)\)/) { }
0 0 elsif (($_t, $_v) = $line =~ /\[(\w+)\s*(\d+)\]/) { }
0 0 elsif (($_v, $_t) = $line =~ /(\d+)\s*(\w+)/) { }
0 0 elsif (($_t, $_v) = $line =~ /NO\s+\[(.*?)\]\s+(.*)$/) { }
262 2 115 if ok_response $line
267 0 2 unless $list[0]
291 0 0 unless $string =~ /^\".*\"$/
295 0 173 unless $_[0]
296 7 166 if ($_[0] eq 'NIL')
301 0 4 unless $_[0]
302 0 4 if ($_[0] eq 'NIL')
309 12 16 if ($rawlist eq 'NIL')
313 0 16 unless $name
314 10 6 dequote $name ? :
0 16 $relay ne 'NIL' ? :
323 1 68 unless $parameters
324 39 29 if substr($parameters, 0, 1) ne '('
341 4 0 if $_t = dequote $date
342 4 0 if $_t = dequote $subject
343 4 0 if $_t = address $from
344 4 0 if $_t = address $sender
345 4 0 if $_t = address $replyto
346 4 0 if $_t = address $to
347 0 4 if $_t = address $cc
348 0 4 if $_t = address $bcc
349 0 4 if $_t = address $inreplyto
350 4 0 if $_t = debracket(dequote $messageid)
359 0 16 unless $structure
368 8 18 if (my(@results) = $substruct =~ /^\((?:($parens+) ($string)|\"MESSAGE\" \"RFC822\" ($nparens) ($nstring) ($nstring) ($string) ($number) ($parens) ($parens) ($number))(?: ($nparens)(?: ($nparens)(?: ($nparens|$string)(?: ($nstring)(?:( $string| $number| $parens)+)?)?)?)?)?\)$/) { }
18 0 elsif (my($type, $subtype, $parameters, $id, $description, $encoding, $size, $lines, $md5, $dsp, $lang, $loc, @extentions) = $substruct =~ /^\(($string) ($string) ($nparens) ($nstring) ($nstring) ($string) ($number)(?: ($number))?(?: ($nstring)(?: ($nparens)(?: ($nparens|$string)(?: ($nstring)(?:( $string| $number| $parens)+)?)?)?)?)?\)$/) { }
373 8 0 if ($body1) { }
384 0 0 if ($key =~ /^\d+$/) { }
395 0 8 if $envelope
396 0 8 if %envelope
398 8 0 if $subtype
399 0 8 if $parameters and $parameters ne 'NIL'
400 0 8 if $id and $id ne 'NIL'
401 0 8 if $description and $description ne 'NIL'
402 0 8 if $encoding
403 0 8 if $size
404 0 8 if $lines
405 0 8 if $dsp and $dsp ne 'NIL'
406 0 8 if $lang and $lang ne 'NIL'
407 0 8 if $loc and $loc ne 'NIL'
408 4 4 if $ext_parameters and $ext_parameters ne 'NIL'
421 0 18 if $id ne 'NIL'
422 0 18 if $description and $description ne 'NIL'
425 12 6 if $lines
426 0 18 if $md5 and $md5 ne 'NIL'
427 2 16 if $dsp and $dsp ne 'NIL'
428 0 18 if $lang and $lang ne 'NIL'
429 0 18 if $loc and $loc ne 'NIL'
438 8 8 if ($level == 0) { }
441 6 2 if ($ret{'1'}{'1'}) { }
460 4 5 if ($line =~ /^\* (\d+) FETCH \(/gs) { }
4 1 elsif (ok_response $line) { }
466 0 1 if $msgid < 0
486 0 25 unless my($key, $length) = $fetchsets{$msgid} =~ /^(BODY|BODYSTRUCTURE|ENVELOPE|FLAGS|INTERNALDATE|UID|RFC822.SIZE|BODY\[.*?\](?:\<\d+\>)?|RFC822(?:\.TEXT|\.HEADER)?) (?:\{(\d+)\}\r?\n?)?/sig
487 1 24 $length ? :
488 1 24 if ($length) { }
492 0 1 if (length $result_entries{$key}{'value'} < $length)
497 0 24 unless ($result_entries{$key}{'value'}) = $fetchsets{$msgid} =~ /^($parens|$nstring|$number)/sig
501 25 0 if $fetchsets{$msgid}
507 4 21 if ($key eq 'FLAGS') { }
1 20 elsif ($key =~ /^BODY\[(.*)\](?:\<(\d+)\>)?$/) { }
0 20 elsif ($key eq 'RFC822') { }
0 20 elsif (my($token) = $key =~ /^RFC822.(.+)$/) { }
4 16 elsif ($key eq 'INTERNALDATE') { }
4 12 elsif ($key eq 'ENVELOPE') { }
8 4 elsif ($key eq 'BODY' or $key eq 'BODYSTRUCTURE') { }
513 1 0 unless ($ret{'BODY'})
516 1 0 unless ($$hashptr{$next})
524 1 0 if $offset
543 0 4 unless %ret
546 0 4 unless %results
560 4 8 unless $line =~ s/^\*\s+SEARCH\s+([\d+\s]+)\s*\r\n$/$1/
564 4 1 @results ? :
5 5 wantarray ? :
571 0 0 if $$hash{'l'}
572 0 0 if $$hash{'l'}
573 0 0 if $$hash{'r'}
574 0 0 if $$hash{'s'}
575 0 0 if $$hash{'w'}
576 0 0 if $$hash{'i'}
577 0 0 if $$hash{'p'}
578 0 0 if $$hash{'c'}
579 0 0 if $$hash{'d'}
580 0 0 if $$hash{'a'}
581 0 0 if $$hash{'a'}
584 0 0 if $$hash{'lookup'} or $$hash{'list'}
585 0 0 if $$hash{'read'}
586 0 0 if $$hash{'seen'}
587 0 0 if $$hash{'write'}
588 0 0 if $$hash{'insert'}
589 0 0 if $$hash{'post'}
590 0 0 if $$hash{'create'}
591 0 0 if $$hash{'delete'}
592 0 0 if $$hash{'admin'} or $$hash{'administer'}
602 2 3 if (my(@resources) = $line =~ /^\* QUOTA $localroot ($parens+)\r\n$/) { }
1 2 elsif (my($ref) = $line =~ /^\* QUOTAROOT $localroot (.*)\r\n$/) { }
605 2 0 if (defined $topic)
680 0 0 if ($#r < 1) { }
699 0 0 if $_t
749 0 8 if (my $server = shift()) { }
750 0 0 if ($self->connect('PeerAddr', $server)) { }
763 0 0 if ($Instances{$$self{'ID'}})
772 0 0 $Instances{$key}{'name'} ? :
816 0 0 if ($level >= 0) { }
834 0 0 if ($action eq 'error' or $action eq 'abort') { }
852 0 0 if ($action eq 'last' or $action eq 'stack') { }
903 0 0 unless $$self{'server'}
905 0 0 $argset[0] ? :
910 0 0 if ($resp) { }
914 0 0 if ($datasizemax > 0)
917 0 0 if ($datasize >= $datasizemax)
924 0 0 if (untagged_response $resp)
925 0 0 if ($resp =~ /\{(\d+)\}\s*$/)
931 0 0 if (ok_response $resp) { }
0 0 elsif (continue_response $resp) { }
0 0 elsif (failure_response $resp) { }
0 0 elsif (untagged_response $resp) { }
932 0 0 if ($i != $#argset)
936 0 0 if ($server_response_callback)
939 0 0 if (my($_v, $_t) = $line =~ /(\d+)\s*(\w+)/)
941 0 0 if (lc $_t eq lc $attr)
952 0 0 if ($i < $#argset) { }
963 0 0 unless (lc $command eq 'fetch' or lc $command eq 'uid fetch')
1028 0 0 unless %args
1029 0 0 $args{'ConnectMethod'} ? :
1035 0 0 if ($method eq 'SSL') { }
0 0 elsif ($method eq 'STARTTLS') { }
0 0 elsif ($method eq 'PLAIN') { }
1037 0 0 unless ($server = 'IO::Socket::SSL'->new(%args))
1043 0 0 unless ($server = 'IO::Socket::INET'->new(%args))
1049 0 0 unless ($server = 'IO::Socket::INET'->new(%args))
1060 0 0 if ($resp[0] and untagged_ok_response @resp and ok_response $self->noop) { }
1062 0 0 if ($method eq 'STARTTLS') { }
1063 0 0 if ($self->starttls(%args)) { }
1078 0 0 if (not $connected) { }
1100 0 0 if ($$self{'server'})
1125 0 0 unless ref $callback_func eq 'CODE' or not defined $callback_func
1159 0 0 if ($$self{'capability'})
1165 0 0 if ($resp[0])
1169 0 0 if (my($capability) = $line =~ /^\*\s+CAPABILITY (.*)$/)
1229 0 0 unless ($self->check_capability('STARTTLS'))
1235 0 0 if ('IO::Socket::SSL'->start_SSL($$self{'server'}, %args)) { }
1267 0 0 unless defined $autheduser
1276 0 0 unless defined $autheduser
1368 0 0 if ($server) { }
1369 0 0 unless $self->_imap_command('CREATE', quote_once($mailbox) . " $server")
1371 0 0 unless $self->_imap_command('CREATE', quote_once $mailbox)
1375 0 0 if ($$properties{'quota'})
1377 0 0 unless ($$properties{'quota'}{$type} =~ /^\d+$/)
1382 0 0 unless ($self->setquota($mailbox, $type, $$properties{'quota'}{$type}))
1389 0 0 if ($$properties{'permissions'})
1392 0 0 unless ($self->setacl($mailbox, $owner, $self->buildacl($$properties{'permissions'})))
1402 0 0 unless ($self->delete($mailbox))
1470 0 0 if wantarray
1473 0 0 unless $result[0]
1475 0 0 wantarray ? :
1487 0 0 if wantarray
1490 0 0 unless $result[0]
1492 0 0 wantarray ? :
1510 0 0 unless (@statuslist)
1521 0 0 unless $resp[0]
1525 0 0 unless $line =~ s/^\*\s+STATUS\s+\S+\s+\((.*?)\)\r\n$/$1/
1565 0 0 unless $flaglist
1567 0 0 $self->check_capability('LITERAL+') ? :
1571 0 0 if ($self->check_capability('UIDPLUS'))
1629 0 0 $charset ? :
1738 0 0 unless is_sequence_set $sequence
1741 0 0 unless $fetchstring
1783 0 0 unless is_sequence_set $sequence
1797 0 0 unless is_sequence_set $sequence
1814 0 0 unless is_sequence_set $sequence
1828 0 0 unless is_sequence_set $sequence
1831 0 0 unless $fetchstring
1848 0 0 unless is_sequence_set $sequence
1865 0 0 unless is_sequence_set $sequence
1866 0 0 unless $self->check_capability('UIDPLUS')
1926 0 0 unless $resp[0]
1930 0 0 if (my($set) = $line =~ /^\* ACL \"?$mailbox\"? (.*)\r\n$/i)
1978 0 0 if (scalar keys %{$acls{$user};} == 0)
1996 0 0 unless $resp[0]
2000 0 0 if (my($permissionstring) = $line =~ /^\* LISTRIGHTS $mailbox $user (.*)\r\n$/i)
2020 0 0 unless $resp[0]
2024 0 0 if (my($permissionstring) = $line =~ /^\* MYRIGHTS \"?$mailbox\"? (.*)\r\n$/i)
2062 0 0 unless $self->check_capability('QUOTA')
2065 0 0 unless $resp[0]
2081 0 0 unless $self->check_capability('QUOTA')
2084 0 0 unless $resp[0]
2108 0 0 if wantarray
2110 0 0 unless $self->check_capability('MAILBOX-REFERRALS')
2112 0 0 unless $result[0]
2114 0 0 wantarray ? :
2132 0 0 if wantarray
2134 0 0 unless $self->check_capability('MAILBOX-REFERRALS')
2136 0 0 unless $result[0]
2138 0 0 wantarray ? :
2204 0 0 unless $self->check_capability('ID')
2206 0 0 if (%perams) { }
2209 0 0 if (length $key > 30)
2212 0 0 if (length $perams{$key} > 1024)
2342 0 0 unless ($self->check_capability('ANNOTATEMORE') or $self->check_capability('ANNOTATEMORE2'))
2348 0 0 unless $resp[0]
2381 0 0 unless ($self->check_capability('ANNOTATEMORE') or $self->check_capability('ANNOTATEMORE2'))
2458 0 0 if ($acl eq 'all') { }
0 0 elsif ($acl eq 'none') { }
0 0 elsif ($acl =~ /^[lrswipcda0123456789]{2,}$/) { }
0 0 elsif ($acl eq 'l' or $acl eq 'lookup' or $acl eq 'list') { }
0 0 elsif ($acl eq 'r' or $acl eq 'read') { }
0 0 elsif ($acl eq 's' or $acl eq 'seen') { }
0 0 elsif ($acl eq 'w' or $acl eq 'write') { }
0 0 elsif ($acl eq 'i' or $acl eq 'insert') { }
0 0 elsif ($acl eq 'p' or $acl eq 'post') { }
0 0 elsif ($acl eq 'c' or $acl eq 'create') { }
0 0 elsif ($acl eq 'd' or $acl eq 'delete') { }
0 0 elsif ($acl eq 'a' or $acl eq 'admin' or $acl eq 'administer') { }
0 0 elsif ($acl =~ /^\d$/) { }
2590 0 0 if (ref $bodies eq 'HASH')
2596 0 0 if (exists $$body{'offset'} and not exists $$body{'length'})
2601 0 0 if ($$body{'header'})
2602 0 0 if (uc $$body{'header'} eq 'ALL') { }
0 0 elsif (uc $$body{'header'} eq 'MATCH') { }
0 0 elsif (uc $$body{'header'} eq 'NOT') { }
2605 0 0 unless $$body{'headerfields'}
2608 0 0 unless $$body{'headerfields'}
2613 0 0 if $$body{'body'}
2614 0 0 if $bodystr
2616 0 0 $$body{'peek'} ? :
2618 0 0 if ($$body{'offset'} or $$body{'length'})
2624 0 0 if ($other)
2628 0 0 if ($item =~ /^(BODY|BODYSTRUCTURE|ENVELOPE|FLAGS|INTERNALDATE|UID|RFC822|RFC822\.HEADER|RFC822\.SIZE|RFC822\.TEXT|ALL|FAST|FULL)$/) { }
2656 0 0 if (@flags)
2686 0 0 unless $$self{'capability_checking'}
2687 0 0 unless $$self{'capability'}
2688 0 0 $$self{'capabilities'}{$tag} ? :
2704 0 0 unless $url
2707 0 0 unless $uri->scheme eq 'imap'
2718 0 0 if (my($option) = $dir =~ /^\;(.*)$/) { }