Condition Coverage

blib/lib/Cookie/Jar.pm
Criterion Covered Total %
condition 121 597 20.2


and 3 conditions

line !l l&&!r l&&r condition
20 2 0 0 exists $ENV{'MOD_PERL'} and $MOD_PERL = $ENV{'MOD_PERL'} =~ m[^mod_perl/(\d+\.[\d\.]+)]
55 2 6 0 @_ and @_ % 2
78 8 0 0 $file and $file->exists
8 0 0 $file and $file->exists and not $file->is_empty
123 0 10 0 $self->_is_object($this) and not $this->isa("Cookie")
171 0 0 5 $req->can("uri") and $req->can("header")
201 5 0 0 defined $port and CORE::length $port
215 0 5 0 $res and not $res->domain->length
238 0 0 12 $c->host_only and $root eq $c->domain
0 0 0 not $c->host_only and $host eq $c->domain
243 11 0 0 not $is_secure and $c->secure
5 5 1 $c->expires and $c->expires < $now
0 10 0 $c->port and $c->port != $port
347 0 0 1 scalar @_ == 1 and $self->_is_a($_[0], "Cookie")
388 0 0 0 defined $name and CORE::length "$name"
396 0 0 0 ref $c and $self->_is_a($c, "Cookie")
422 0 0 6 ref $c and $self->_is_a($c, "Cookie")
455 0 0 0 defined $name and CORE::length $name
467 0 0 0 $resp->can("uri") and $resp->can("header")
509 4 0 0 defined $port and CORE::length $port
562 0 0 0 CORE::length $c_dom >= CORE::length $root and $c_dom eq $host || $host =~ /\.$c_dom$/
587 1 0 3 defined $o->param("path") and CORE::length $o->param("path")
640 0 0 1 defined $opts->{'host'} and CORE::length $opts->{'host'}
709 0 0 1 defined $o->param("path") and CORE::length $o->param("path")
727 0 0 1 defined $opts->{'port'} and $self->_is_integer($opts->{'port'})
745 0 0 1 $opts->{'request'} and $self->_is_object($opts->{'request'})
0 0 1 $opts->{'request'} and $self->_is_object($opts->{'request'}) and $opts->{'request'}->can("header")
823 4 4 0 scalar @_ == 1 and $self->_is_a($_[0], "Cookie")
4 0 4 scalar @_ == 1 and ref $_[0] eq "HASH"
0 0 4 scalar @_ > 0 and scalar @_ <= 3
843 0 0 8 defined $name and CORE::length $name
867 0 0 5 defined $host and CORE::length $host
873 1 4 0 defined $c_host and $host eq $c_host || index(reverse($host), reverse(".$c_host")) == 0
876 0 3 1 defined $path and CORE::length "$path"
912 0 0 5 defined $host and CORE::length $host
918 0 0 0 $opts->{'with_subdomain'} and $host =~ /\.$dom$/
940 8 0 17 scalar @_ == 1 and $self->_is_a($_[0], "Cookie")
950 1 7 0 ref $name and $self->_is_a($name, ref $self)
953 3 0 22 defined $host and CORE::length $host
985 0 0 0 defined $key and CORE::length "$key"
986 0 0 0 defined $algo and CORE::length "$algo"
1024 0 0 3 exists $def->{'name'} && exists $def->{'value'}
0 0 3 defined $def->{'name'} && CORE::length $def->{'name'}
1073 0 0 0 defined $key and CORE::length "$key"
1074 0 0 0 defined $algo and CORE::length "$algo"
1117 0 0 0 exists $opts->{'use_dbi'} && defined $opts->{'use_dbi'} && $opts->{'use_dbi'}
1147 0 0 0 defined $dbi_error and exists $opts->{'use_dbi'}
0 0 0 defined $dbi_error and exists $opts->{'use_dbi'} and defined $opts->{'use_dbi'}
0 0 0 defined $dbi_error and exists $opts->{'use_dbi'} and defined $opts->{'use_dbi'} and $opts->{'use_dbi'}
1218 0 0 0 exists $opts->{'sqlite'} and defined $opts->{'sqlite'}
0 0 0 exists $opts->{'sqlite'} and defined $opts->{'sqlite'} and CORE::length $opts->{'sqlite'}
1331 0 0 0 $c->can("name") and $c->can("value")
0 0 0 $c->can("name") and $c->can("value") and $c->can("domain")
0 0 0 $c->can("name") and $c->can("value") and $c->can("domain") and $c->can("path")
0 0 0 $c->can("name") and $c->can("value") and $c->can("domain") and $c->can("path") and $c->can("expires")
0 0 0 $c->can("name") and $c->can("value") and $c->can("domain") and $c->can("path") and $c->can("expires") and $c->can("max_age")
0 0 0 $c->can("name") and $c->can("value") and $c->can("domain") and $c->can("path") and $c->can("expires") and $c->can("max_age") and $c->can("port")
0 0 0 $c->can("name") and $c->can("value") and $c->can("domain") and $c->can("path") and $c->can("expires") and $c->can("max_age") and $c->can("port") and $c->can("secure")
0 0 0 $c->can("name") and $c->can("value") and $c->can("domain") and $c->can("path") and $c->can("expires") and $c->can("max_age") and $c->can("port") and $c->can("secure") and $c->can("same_site")
0 0 0 $c->can("name") and $c->can("value") and $c->can("domain") and $c->can("path") and $c->can("expires") and $c->can("max_age") and $c->can("port") and $c->can("secure") and $c->can("same_site") and $c->can("http_only")
1402 1 1 21 defined $raw and CORE::length $raw
1613 3 0 0 $c->discard and $opts->{'skip_discard'}
1614 3 0 0 $c->expires and $c->expires < $now
3 0 0 $c->expires and $c->expires < $now and $opts->{'skip_expired'}
1622 3 0 0 defined $vals->{'port'} and CORE::length $vals->{'port'}
1623 0 0 3 defined $vals->{'path_spec'} and $vals->{'path_spec'}
1624 0 0 3 defined $vals->{'secure'} and $vals->{'secure'}
1625 0 3 0 defined $vals->{'secure'} and $vals->{'expires'}
1626 3 0 0 defined $vals->{'discard'} and $vals->{'discard'}
1627 3 0 0 defined $vals->{'comment'} and CORE::length $vals->{'comment'}
1632 3 0 0 defined $vals->{'commentURL'} and CORE::length $vals->{'commentURL'}
1669 0 0 0 exists $opts->{'use_dbi'} && defined $opts->{'use_dbi'} && $opts->{'use_dbi'}
1716 0 0 0 $c->discard and $opts->{'skip_discard'}
1717 0 0 0 $c->expires and $c->expires < $now
0 0 0 $c->expires and $c->expires < $now and $opts->{'skip_expired'}
1783 0 0 0 defined $dbi_error and exists $opts->{'use_dbi'}
0 0 0 defined $dbi_error and exists $opts->{'use_dbi'} and defined $opts->{'use_dbi'}
0 0 0 defined $dbi_error and exists $opts->{'use_dbi'} and defined $opts->{'use_dbi'} and $opts->{'use_dbi'}
1968 0 0 0 defined $dbi_error and not $requires_dbi
0 0 0 exists $opts->{'sqlite'} and defined $opts->{'sqlite'}
0 0 0 exists $opts->{'sqlite'} and defined $opts->{'sqlite'} and CORE::length $opts->{'sqlite'}
1972 0 0 0 exists $opts->{'sqlite'} and defined $opts->{'sqlite'}
0 0 0 exists $opts->{'sqlite'} and defined $opts->{'sqlite'} and CORE::length $opts->{'sqlite'}
2028 0 0 0 $table_moz_cookies_exists and $opts->{'overwrite'}
2050 0 0 0 defined $sql_v && $sql_v >= $req_v
2100 0 0 0 $opts->{'log_sql'} and defined $log_file
0 0 0 $opts->{'log_sql'} and defined $log_file and $log_file->opened
2125 0 0 0 $c->discard and $opts->{'skip_discard'}
2126 0 0 0 $c->expires and $c->expires < $now
0 0 0 $c->expires and $c->expires < $now and $opts->{'skip_expired'}
2156 0 0 4 $opts->{'response'} and $self->_is_object($opts->{'response'})
0 0 4 $opts->{'response'} and $self->_is_object($opts->{'response'}) and $opts->{'response'}->can("header")
2180 0 0 0 defined $key and CORE::length "$key"
2181 0 0 0 defined $algo and CORE::length "$algo"
2211 0 0 0 defined $iv and CORE::length "$iv"
2260 0 8 0 $self->autosave and $file

or 2 conditions

line l !l condition
131 3 0 'Module::Generic::HeaderValue'->new_from_header($this, 'decode', 1, 'debug', $self->debug) || (return $self->error('Module::Generic::HeaderValue'->error))
157 16 0 $self->key($this) || (return $self->pass_error)
169 5 0 shift @_ || (return $self->error('No request object was provided.'))
172 5 0 $req->uri || (return $self->error('No uri set in the request object.'))
212 5 0 'Cookie::Domain'->new || (return $self->pass_error('Cookie::Domain'->error))
363 0 0 $idx->{$key} // "undef"
386 0 0 $self->host || ''
387 0 0 $path //= ""
392 0 0 $idx->{$key} // "undef"
416 2 0 shift @_ || (return $self->error('No callback code was provided.'))
453 0 0 $self->host || ''
454 0 0 $path //= ""
464 4 0 shift @_ || (return $self->error('No response object was provided.'))
481 4 0 'Module::Generic::HeaderValue'->new_from_multi([$resp->header('Set-Cookie')], 'debug', $self->debug, 'decode', 1) || (return $self->pass_error('Module::Generic::HeaderValue'->error))
517 4 0 'Cookie::Domain'->new || (return $self->pass_error('Cookie::Domain'->error))
530 4 0 'Cookie'->new('name', $name, 'value', $value) || (return $self->pass_error('Cookie'->error))
636 0 1 $opts->{'path'} //= "/"
649 1 0 'Cookie::Domain'->new || (return $self->pass_error('Cookie::Domain'->error))
660 1 0 'Module::Generic::HeaderValue'->new_from_header("$str") || (return $self->pass_error('Module::Generic::HeaderValue'->error))
663 1 0 'Cookie'->new('name', $name, 'value', $value) || (return $self->pass_error('Cookie'->error))
739 0 1 $opts->{'string'} //= ""
741 0 1 $opts->{'host'} || $self->host || ''
791 0 0 $ENV{'HTTP_COOKIE'} // ""
798 3 0 $self->make('name', $def->{'name'}, 'value', $def->{'value'}) || (return $self->pass_error)
844 0 0 $self->host || ''
845 4 4 $path //= ""
950 0 0 $name // "undef"
963 1 0 shift @_ || (return $self->error('No filename was provided.'))
965 0 1 $opts->{'host'} //= ""
966 0 1 $opts->{'decrypt'} //= 0
967 0 1 $opts->{'algo'} //= ""
970 0 1 $self->_initialisation_vector->scalar || ''
971 0 1 $opts->{'host'} || $self->host || ''
972 1 0 $self->new_file($file) || (return $self->pass_error)
988 0 0 $self->_encrypt_objects(@$opts{'key', 'algo', 'iv'}) || (return $self->pass_error)
1045 1 0 shift @_ || (return $self->error('No filename was provided.'))
1047 0 1 $opts->{'decrypt'} //= 0
1048 0 1 $opts->{'algo'} //= ""
1051 0 1 $self->_initialisation_vector->scalar || ''
1053 0 1 $opts->{'host'} || $self->host || ''
1076 0 0 $self->_encrypt_objects(@$opts{'key', 'algo', 'iv'}) || (return $self->pass_error)
1090 0 0 $scalar->open || (return $self->pass_error($!))
1105 0 0 shift @_ || (return $self->error('No filename was provided.'))
1106 0 0 $self->new_file($file) || (return $self->pass_error)
1108 0 0 $opts->{'use_dbi'} //= 0
1109 0 0 $opts->{'sqlite'} //= ""
1112 0 0 $f->copy($tmpfile) || (return $self->pass_error)
1178 0 0 'DBI'->connect("dbi:SQLite:dbname=$sqldb", '', '', {'RaiseError', 1}) || die("Unable to connect to SQLite database file ${sqldb}: ", $DBI::errstr)
1180 0 0 $dbh->table_info(undef, undef, 'moz_cookies', 'TABLE') || die("Error checking for existence of table 'moz_cookies' in SQLite database file ${sqldb}: ", $dbh->errstr)
1189 0 0 $dbh->prepare($sql) || die("Error preparing the sql query to get all mozilla cookies from database ${sqldb}: ", $dbh->errstr, "\nSQL query was: $sql")
1275 0 0 shift @_ || (return $self->error('No filename was provided.'))
1276 0 0 $self->new_file($file) || (return $self->pass_error)
1278 0 0 $opts->{'host'} || $self->host || ''
1314 0 0 shift @_ || (return $self->error('No Cookie::Jar object was provided to merge.'))
1316 0 0 $jar // "undef"
1319 0 0 $opts->{'overwrite'} //= 0
1320 0 0 $self->host || ''
1321 0 0 $opts->{'die'} //= 0
1385 0 0 $c // "undef"
1455 0 0 $self->key($old) || (return $self->pass_error)
1480 0 0 $self->key($c) || (return $self->pass_error)
1505 1 0 shift @_ || (return $self->error('No filename was provided.'))
1507 0 1 $opts->{'encrypt'} //= 0
1508 0 1 $opts->{'algo'} //= ""
1511 0 1 $self->_initialisation_vector->scalar || ''
1512 0 1 $opts->{'format'} //= ""
1543 1 0 $self->new_file($file) || (return $self->pass_error)
1561 0 0 $self->_encrypt_objects(@$opts{'key', 'algo', 'iv'}) || (return $self->pass_error)
1579 1 0 shift @_ || (return $self->error('No filename was provided.'))
1581 0 1 $opts->{'encrypt'} //= 0
1582 0 1 $opts->{'algo'} //= ""
1585 0 1 $self->_initialisation_vector->scalar || ''
1586 0 1 $opts->{'skip_discard'} //= 0
1587 0 1 $opts->{'skip_expired'} //= 0
1589 1 0 $self->new_file($file) || (return $self->pass_error)
1596 0 0 $self->_encrypt_objects(@$opts{'key', 'algo', 'iv'}) || (return $self->pass_error)
1599 1 0 $f->open('>', {'binmode', $opts->{'encrypt'} ? 'raw' : 'utf-8'}) || (return $self->error(qq[Unable to write cookies to file "$file": ], $f->error))
1657 0 0 shift @_ || (return $self->error('No database file to write cookies was specified.'))
1659 0 0 $opts->{'log_sql'} //= ""
1660 0 0 $opts->{'overwrite'} //= 0
1661 0 0 $opts->{'rollback'} //= 0
1662 0 0 $opts->{'skip_discard'} //= 0
1663 0 0 $opts->{'skip_expired'} //= 0
1664 0 0 $opts->{'sqlite'} //= ""
1665 0 0 $opts->{'use_dbi'} //= 0
1666 0 0 $self->new_file($file) || (return $self->pass_error)
1767 0 0 $self->new_file($opts->{'log_sql'}) || (return $self->pass_error)
1792 0 0 'DBI'->can($core_fields->{$f}{'constant'}) || die(q[Invalid data type '], $core_fields->{$f}{'constant'}, q[' for DBI.])
1801 0 0 'DBI'->connect("dbi:SQLite:dbname=$sqldb", '', '', {'RaiseError', 1, 'AutoCommit', 1}) || die("Unable to connect to SQLite database file ${sqldb}: ", $DBI::errstr)
1818 0 0 $dbh->prepare($version_sql) || die('Errror preparing sql query to get the SQLite driver version: ', $dbh->errstr, "\nSQL query was $version_sql")
1820 0 0 $version_sth->execute || die('Errror executing sql query to get the SQLite driver version: ', $version_sth->errstr, "\nSQL query was $version_sql")
1829 0 0 $dbh->prepare(q[SELECT name FROM sqlite_master WHERE type IN ('table') AND name IS 'moz_cookies']) || die("Error preparing sql query to check for existence of table 'moz_cookies' in SQLite database file ${sqldb}: ", $dbh->errstr)
1831 0 0 $tbl_check->execute || die(q[Error executing query to check existence of table 'moz_cookies': ], $tbl_check->errstr)
1840 0 0 $dbh->prepare($drop_sql) || die("Error preparing query to drop existing table moz_cookies in SQLIte database file ${sqldb}: ", $dbh->errstr, "\nSQL query was ${$drop_sql;}")
1842 0 0 $drop_sth->execute || die("Error executing query to drop existing table moz_cookies in SQLIte database file ${sqldb}: ", $drop_sth->errstr, "\nSQL query was ${$drop_sql;}")
1851 0 0 $dbh->prepare($tbl_info_sql) || die(q[Error while trying to prepare query to get the existing table 'moz_cookies' information: ], $dbh->errstr, "\nSQL query is: $tbl_info_sql")
1853 0 0 $tbl_info_sth->execute || die(q[Error while trying to execute query to get the existing table 'moz_cookies' information: ], $tbl_info_sth->errstr, "\nSQL query is: $tbl_info_sql")
1876 0 0 scalar @$missing or scalar @$bad_datatype
1891 0 0 $dbh->prepare($create_table_sql) || die("Error preparing query to create table moz_cookies in SQLite database file ${sqldb}: ", $dbh->errstr, "\nSQL query was: $create_table_sql")
1893 0 0 $create_table_sth->execute || die("Error executing query to create table moz_cookies in SQLite database file ${sqldb}: ", $create_table_sth->errstr, "\nSQL query was: $create_table_sql")
1896 0 0 $dbh->prepare($insert_ignore_sql) || die("Error preparing the sql query to add/ignore cookies to 'moz_cookies' in SQLite database file ${sqldb}: ", $dbh->errstr, "\nSQL query was: $insert_ignore_sql")
1906 0 0 $dbh->prepare($upsert_sql) || die("Error preparing the sql query to add cookies to 'moz_cookies' in SQLite database file ${sqldb}: ", $dbh->errstr, "\nSQL query was: $upsert_sql")
1911 0 0 $dbh->prepare($insert_replace_sql) || die("Error preparing the sql query to add/replace cookies to 'moz_cookies' in SQLite database file ${sqldb}: ", $dbh->errstr, "\nSQL query was: $insert_replace_sql")
1933 0 0 $insert_sth->execute || die(q[Failed to execute query to insert cookie '], $c->name->scalar, q[' -> ], $insert_sth->errstr, "\nQuery was $insert_ignore_sql")
2015 0 0 $table_moz_cookies_exists //= ""
2113 0 0 $opts->{'file'} //= ""
2114 0 0 $opts->{'skip_discard'} //= 0
2115 0 0 $opts->{'skip_expired'} //= 0
2117 0 0 $self->new_file($opts->{'file'}) || (return $self->pass_error)
2118 0 0 $f->open('>', {'binmode', 'utf-8'}) || (return $self->error(qq[Unable to write cookies to file "$opts->{'file'}": ], $f->error))
2154 4 0 $opts->{'response'} //= ""

or 3 conditions

line l !l&&r !l&&!r condition
123 0 0 10 not $self->_is_object($this) or $self->_is_object($this) and not $this->isa("Cookie")
215 0 0 5 not CORE::length $res or $res and not $res->domain->length
238 12 0 0 $c->host_only and $root eq $c->domain or not $c->host_only and $host eq $c->domain
332 0 0 0 $r or $resp
386 0 0 0 $host ||= $self->host || ''
453 0 0 0 $host ||= $self->host || ''
486 0 4 0 $resp->header('Host') || $resp->request && ($host = $resp->request->header('Host'))
562 0 0 0 $c_dom eq $host || $host =~ /\.$c_dom$/
595 0 1 0 $path eq "/" or substr($path, -1, 1) eq "/"
619 1 0 0 $self->delete($_) || do {
717 0 0 0 $opts->{'path'} eq "/" or substr($opts->{'path'}, -1, 1) eq "/"
844 8 0 0 $host //= $self->host || ''
873 4 0 0 $host eq $c_host || index(reverse($host), reverse(".$c_host")) == 0
918 12 0 0 $dom eq $host or $opts->{'with_subdomain'} and $host =~ /\.$dom$/
970 0 0 1 $opts->{'iv'} //= $self->_initialisation_vector->scalar || ''
1034 3 0 0 $self->make($def) || do {
1051 0 0 1 $opts->{'iv'} //= $self->_initialisation_vector->scalar || ''
1136 0 0 0 $opts->{'use_dbi'} || $opts->{'sqlite'}
0 0 0 $requires_dbi or not $opts->{'use_dbi'} || $opts->{'sqlite'}
1215 0 0 0 scalar @$cookies or $requires_dbi
1320 0 0 0 $opts->{'host'} //= $self->host || ''
1449 0 0 0 $c->name ne $old->name or $c->domain ne $old->domain
0 0 0 $c->name ne $old->name or $c->domain ne $old->domain or $c->path ne $old->path
1511 0 0 1 $opts->{'iv'} //= $self->_initialisation_vector->scalar || ''
1585 0 0 1 $opts->{'iv'} //= $self->_initialisation_vector->scalar || ''
1773 0 0 0 $opts->{'use_dbi'} || $opts->{'sqlite'}
0 0 0 $requires_dbi or not $opts->{'use_dbi'} || $opts->{'sqlite'}
1968 0 0 0 defined $dbi_error and not $requires_dbi or exists $opts->{'sqlite'} and defined $opts->{'sqlite'} and CORE::length $opts->{'sqlite'}
2250 0 0 0 $x eq '2F' || $x eq '25'