Branch Coverage

blib/lib/Search/Estraier.pm
Criterion Covered Total %
branch 81 266 30.4


line true false branch
107 0 22 unless defined $text
170 1 4 if ($draft)
174 4 7 if ($in_text)
175 1 3 if ($line =~ /^\t/) { }
183 1 6 if ($line =~ /^%VECTOR\t(.+)$/) { }
0 6 elsif ($line =~ /^%SCORE\t(.+)$/) { }
0 6 elsif ($line =~ /^%/) { }
1 5 elsif ($line =~ /^$/) { }
5 0 elsif ($line =~ /^(.+)=(.*)$/) { }
185 1 0 if ($#fields % 2 == 1) { }
210 5 0 $self ? :
231 5 5 if (not defined $value) { }
253 0 3 unless defined $text
270 0 1 unless defined $text
288 0 1 unless @_
291 0 1 unless $#_ % 2 == 1
307 0 1 unless defined $score
319 1 1 unless defined $$self{'score'}
347 0 3 unless $$self{'attrs'}
364 1 11 unless defined $name and $$self{'attrs'}
380 1 1 if $$self{'dtexts'}
394 1 1 if $$self{'dtexts'}
411 0 10 unless defined(my $v = $$self{'attrs'}{$attr_name})
415 2 2 if ($$self{'kwords'})
423 1 3 if (defined $$self{'score'} and $$self{'score'} >= 0)
429 2 2 if $$self{'dtexts'}
430 2 2 if $$self{'htexts'}
485 1 0 $self ? :
535 1 1 unless $max =~ /^\d+$/
597 2 14 unless ($mask = $$options{$option})
598 1 1 if ($option eq '1') { }
649 2 0 if $$self{'attrs'}
750 0 1 unless @_
783 1 1 unless defined $$self{'uri'}
785 1 0 $self ? :
813 0 1 unless wantarray
885 1 2 unless defined $$self{$f}
888 1 0 $self ? :
922 0 5 unless $num =~ /^\d+$/
923 0 5 if $num < 0 or $num > $$self{'docs'}
1058 0 1 if ($#_ == 0) { }
1063 0 1 if $$self{'user'}
1065 0 1 if $$self{'debug'}
1074 0 1 if ($$self{'create'})
1075 0 0 if (not eval { do { $self->name } } or $@)
1076 0 0 if $$self{'url'} =~ m[/node/([^/]+)/*]
1077 0 0 unless $name
1079 0 0 unless $self->master('action', 'nodeadd', 'name', $name, 'label', $label)
1087 1 0 $self ? :
1116 1 1 unless $port =~ /^\d+$/
1133 1 1 unless $sec =~ /^\d+$/
1184 0 0 unless $$self{'url'} and $doc->isa('Search::Estraier::Document')
1185 0 0 if ($self->shuttle_url($$self{'url'} . '/put_doc', 'text/x-estraier-draft', $doc->dump_draft, undef) == 200)
1210 0 0 unless $$self{'url'}
1211 0 0 unless $id =~ /^\d+$/
1212 0 0 if ($self->shuttle_url($$self{'url'} . '/out_doc', 'application/x-www-form-urlencoded', "id=$id", undef) == 200)
1237 0 0 unless $$self{'url'}
1238 0 0 if ($self->shuttle_url($$self{'url'} . '/out_doc', 'application/x-www-form-urlencoded', 'uri=' . uri_escape($uri), undef) == 200)
1263 0 0 unless $$self{'url'} and $doc->isa('Search::Estraier::Document')
1264 0 0 if ($self->shuttle_url($$self{'url'} . '/edit_doc', 'text/x-estraier-draft', $doc->dump_draft, undef) == 200)
1322 0 0 unless $id and $name
1339 0 0 unless $uri and $name
1422 0 0 unless $$a{'id'} || $$a{'uri'} and $$self{'url'}
1427 0 0 if $$a{'etch'}
1429 0 0 if ($$a{'id'}) { }
0 0 elsif ($$a{'uri'}) { }
1430 0 0 unless $$a{'id'} =~ /^\d+$/
1438 0 0 if ($$a{'attr'})
1451 0 0 if $rv != 200
1453 0 0 if ($$a{'etch'}) { }
0 0 elsif ($$a{'chomp_resbody'}) { }
1455 0 0 unless $resbody
1458 0 0 if $v
1462 0 0 unless defined $resbody
1479 0 0 unless $$self{'inform'}{'name'}
1492 0 0 unless $$self{'inform'}{'label'}
1505 0 0 if $$self{'inform'}{'dnum'} < 0
1518 0 0 if $$self{'inform'}{'wnum'} < 0
1531 0 0 if $$self{'inform'}{'size'} < 0
1552 0 0 unless $cond and defined $depth and $$self{'url'}
1553 0 0 unless $cond->isa('Search::Estraier::Condition')
1554 0 0 unless $depth =~ /^\d+$/
1563 0 0 if $rv != 200
1606 0 0 unless $cond->isa('Search::Estraier::Condition')
1611 0 0 if (my $phrase = $cond->phrase)
1615 0 0 if (my(@attrs) = $cond->attrs)
1617 0 0 if $attrs[$i]
1621 0 0 if (my $order = $cond->order)
1625 0 0 if (my $max = $cond->max) { }
1631 0 0 if (my $options = $cond->options)
1635 0 0 if $depth
1639 0 0 if $$cond{'skip'}
1641 0 0 if (my $distinct = $cond->distinct)
1645 0 0 if ($$cond{'mask'})
1649 0 0 if $mask
1675 0 1 unless defined $croak_on_error
1679 0 1 if $$self{'debug'}
1682 0 1 if (not $url && $url->scheme or !$url->scheme eq 'http' or not $url->host or not $url->port or $url->port < 1)
1694 0 1 if ($reqbody) { }
1702 1 0 if $$self{'auth'}
1705 0 1 if $$self{'debug'}
1707 0 1 if ($reqbody)
1708 0 0 if $$self{'debug'}
1714 0 1 if $$self{'debug'}
1718 1 0 unless ($res->is_success)
1719 1 0 if ($croak_on_error) { }
1728 0 0 if $resbody and $$self{'debug'}
1756 0 0 if $hwidth >= 0
1757 0 0 if $awidth >= 0
1793 0 0 unless $$self{'url'}
1794 0 0 unless $mode =~ /^\d+$/
1818 0 0 unless $$self{'url'}
1819 0 0 unless $credit =~ /^\d+$/
1822 0 0 if $credit > 0
1824 0 0 if ($self->shuttle_url($$self{'url'} . '/_set_link', 'application/x-www-form-urlencoded', $reqbody, undef) == 200)
1846 0 0 unless $$self{'inform'}{'name'}
1860 0 0 unless $$self{'inform'}{'name'}
1874 0 0 unless $$self{'inform'}{'name'}
1889 0 0 unless $$self{'url'}
1898 0 0 if $rv != 200 or not $resbody
1973 0 1 unless $rest
1975 0 1 unless $$rest{'status'}
1979 0 1 if ($$rest{'required'} or $$rest{'optional'})
1981 0 0 unless $$args{$_}
1986 0 0 if $$args{$_}
1996 0 0 unless my $status = $self->shuttle_url('http://' . $uri->host_port . '/master?action=' . $action, 'application/x-www-form-urlencoded', join('&', @args), \$resbody, 1)
2004 0 0 if ($status == $$rest{'status'})
2007 0 0 if $action eq 'sync' or $action =~ /^node(?:add|del|clr)$/
2009 0 0 if ($$rest{'returns'} and wantarray) { }
0 0 elsif ($resbody) { }
2053 0 0 unless $$self{'url'}
2062 0 0 if $rv != 200 or not $resbody
2071 0 0 unless @lines