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")
641 0 0 1 defined $opts->{'host'} and CORE::length $opts->{'host'}
710 0 0 1 defined $o->param("path") and CORE::length $o->param("path")
728 0 0 1 defined $opts->{'port'} and $self->_is_integer($opts->{'port'})
746 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")
824 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
844 0 0 8 defined $name and CORE::length $name
868 0 0 5 defined $host and CORE::length $host
874 1 4 0 defined $c_host and $host eq $c_host || index(reverse($host), reverse(".$c_host")) == 0
877 0 3 1 defined $path and CORE::length "$path"
913 0 0 5 defined $host and CORE::length $host
919 0 0 0 $opts->{'with_subdomain'} and $host =~ /\.$dom$/
941 8 0 17 scalar @_ == 1 and $self->_is_a($_[0], "Cookie")
951 1 7 0 ref $name and $self->_is_a($name, ref $self)
954 3 0 22 defined $host and CORE::length $host
986 0 0 0 defined $key and CORE::length "$key"
987 0 0 0 defined $algo and CORE::length "$algo"
1025 0 0 3 exists $def->{'name'} && exists $def->{'value'}
0 0 3 defined $def->{'name'} && CORE::length $def->{'name'}
1074 0 0 0 defined $key and CORE::length "$key"
1075 0 0 0 defined $algo and CORE::length "$algo"
1118 0 0 0 exists $opts->{'use_dbi'} && defined $opts->{'use_dbi'} && $opts->{'use_dbi'}
1148 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'}
1219 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'}
1332 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")
1403 1 1 21 defined $raw and CORE::length $raw
1614 3 0 0 $c->discard and $opts->{'skip_discard'}
1615 3 0 0 $c->expires and $c->expires < $now
3 0 0 $c->expires and $c->expires < $now and $opts->{'skip_expired'}
1623 3 0 0 defined $vals->{'port'} and CORE::length $vals->{'port'}
1624 0 0 3 defined $vals->{'path_spec'} and $vals->{'path_spec'}
1625 0 0 3 defined $vals->{'secure'} and $vals->{'secure'}
1626 0 3 0 defined $vals->{'secure'} and $vals->{'expires'}
1627 3 0 0 defined $vals->{'discard'} and $vals->{'discard'}
1628 3 0 0 defined $vals->{'comment'} and CORE::length $vals->{'comment'}
1633 3 0 0 defined $vals->{'commentURL'} and CORE::length $vals->{'commentURL'}
1670 0 0 0 exists $opts->{'use_dbi'} && defined $opts->{'use_dbi'} && $opts->{'use_dbi'}
1717 0 0 0 $c->discard and $opts->{'skip_discard'}
1718 0 0 0 $c->expires and $c->expires < $now
0 0 0 $c->expires and $c->expires < $now and $opts->{'skip_expired'}
1784 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'}
1969 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'}
1973 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'}
2029 0 0 0 $table_moz_cookies_exists and $opts->{'overwrite'}
2051 0 0 0 defined $sql_v && $sql_v >= $req_v
2101 0 0 0 $opts->{'log_sql'} and defined $log_file
0 0 0 $opts->{'log_sql'} and defined $log_file and $log_file->opened
2126 0 0 0 $c->discard and $opts->{'skip_discard'}
2127 0 0 0 $c->expires and $c->expires < $now
0 0 0 $c->expires and $c->expires < $now and $opts->{'skip_expired'}
2157 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")
2181 0 0 0 defined $key and CORE::length "$key"
2182 0 0 0 defined $algo and CORE::length "$algo"
2212 0 0 0 defined $iv and CORE::length "$iv"
2262 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))
637 0 1 $opts->{'path'} //= "/"
650 1 0 'Cookie::Domain'->new || (return $self->pass_error('Cookie::Domain'->error))
661 1 0 'Module::Generic::HeaderValue'->new_from_header("$str") || (return $self->pass_error('Module::Generic::HeaderValue'->error))
664 1 0 'Cookie'->new('name', $name, 'value', $value) || (return $self->pass_error('Cookie'->error))
740 0 1 $opts->{'string'} //= ""
742 0 1 $opts->{'host'} || $self->host || ''
792 0 0 $ENV{'HTTP_COOKIE'} // ""
799 3 0 $self->make('name', $def->{'name'}, 'value', $def->{'value'}) || (return $self->pass_error)
845 0 0 $self->host || ''
846 4 4 $path //= ""
951 0 0 $name // "undef"
964 1 0 shift @_ || (return $self->error('No filename was provided.'))
966 0 1 $opts->{'host'} //= ""
967 0 1 $opts->{'decrypt'} //= 0
968 0 1 $opts->{'algo'} //= ""
971 0 1 $self->_initialisation_vector->scalar || ''
972 0 1 $opts->{'host'} || $self->host || ''
973 1 0 $self->new_file($file) || (return $self->pass_error)
989 0 0 $self->_encrypt_objects(@$opts{'key', 'algo', 'iv'}) || (return $self->pass_error)
1046 1 0 shift @_ || (return $self->error('No filename was provided.'))
1048 0 1 $opts->{'decrypt'} //= 0
1049 0 1 $opts->{'algo'} //= ""
1052 0 1 $self->_initialisation_vector->scalar || ''
1054 0 1 $opts->{'host'} || $self->host || ''
1077 0 0 $self->_encrypt_objects(@$opts{'key', 'algo', 'iv'}) || (return $self->pass_error)
1091 0 0 $scalar->open || (return $self->pass_error($!))
1106 0 0 shift @_ || (return $self->error('No filename was provided.'))
1107 0 0 $self->new_file($file) || (return $self->pass_error)
1109 0 0 $opts->{'use_dbi'} //= 0
1110 0 0 $opts->{'sqlite'} //= ""
1113 0 0 $f->copy($tmpfile) || (return $self->pass_error)
1179 0 0 'DBI'->connect("dbi:SQLite:dbname=$sqldb", '', '', {'RaiseError', 1}) || die("Unable to connect to SQLite database file ${sqldb}: ", $DBI::errstr)
1181 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)
1190 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")
1276 0 0 shift @_ || (return $self->error('No filename was provided.'))
1277 0 0 $self->new_file($file) || (return $self->pass_error)
1279 0 0 $opts->{'host'} || $self->host || ''
1315 0 0 shift @_ || (return $self->error('No Cookie::Jar object was provided to merge.'))
1317 0 0 $jar // "undef"
1320 0 0 $opts->{'overwrite'} //= 0
1321 0 0 $self->host || ''
1322 0 0 $opts->{'die'} //= 0
1386 0 0 $c // "undef"
1456 0 0 $self->key($old) || (return $self->pass_error)
1481 0 0 $self->key($c) || (return $self->pass_error)
1506 1 0 shift @_ || (return $self->error('No filename was provided.'))
1508 0 1 $opts->{'encrypt'} //= 0
1509 0 1 $opts->{'algo'} //= ""
1512 0 1 $self->_initialisation_vector->scalar || ''
1513 0 1 $opts->{'format'} //= ""
1544 1 0 $self->new_file($file) || (return $self->pass_error)
1562 0 0 $self->_encrypt_objects(@$opts{'key', 'algo', 'iv'}) || (return $self->pass_error)
1580 1 0 shift @_ || (return $self->error('No filename was provided.'))
1582 0 1 $opts->{'encrypt'} //= 0
1583 0 1 $opts->{'algo'} //= ""
1586 0 1 $self->_initialisation_vector->scalar || ''
1587 0 1 $opts->{'skip_discard'} //= 0
1588 0 1 $opts->{'skip_expired'} //= 0
1590 1 0 $self->new_file($file) || (return $self->pass_error)
1597 0 0 $self->_encrypt_objects(@$opts{'key', 'algo', 'iv'}) || (return $self->pass_error)
1600 1 0 $f->open('>', {'binmode', $opts->{'encrypt'} ? 'raw' : 'utf-8'}) || (return $self->error(qq[Unable to write cookies to file "$file": ], $f->error))
1658 0 0 shift @_ || (return $self->error('No database file to write cookies was specified.'))
1660 0 0 $opts->{'log_sql'} //= ""
1661 0 0 $opts->{'overwrite'} //= 0
1662 0 0 $opts->{'rollback'} //= 0
1663 0 0 $opts->{'skip_discard'} //= 0
1664 0 0 $opts->{'skip_expired'} //= 0
1665 0 0 $opts->{'sqlite'} //= ""
1666 0 0 $opts->{'use_dbi'} //= 0
1667 0 0 $self->new_file($file) || (return $self->pass_error)
1768 0 0 $self->new_file($opts->{'log_sql'}) || (return $self->pass_error)
1793 0 0 'DBI'->can($core_fields->{$f}{'constant'}) || die(q[Invalid data type '], $core_fields->{$f}{'constant'}, q[' for DBI.])
1802 0 0 'DBI'->connect("dbi:SQLite:dbname=$sqldb", '', '', {'RaiseError', 1, 'AutoCommit', 1}) || die("Unable to connect to SQLite database file ${sqldb}: ", $DBI::errstr)
1819 0 0 $dbh->prepare($version_sql) || die('Errror preparing sql query to get the SQLite driver version: ', $dbh->errstr, "\nSQL query was $version_sql")
1821 0 0 $version_sth->execute || die('Errror executing sql query to get the SQLite driver version: ', $version_sth->errstr, "\nSQL query was $version_sql")
1830 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)
1832 0 0 $tbl_check->execute || die(q[Error executing query to check existence of table 'moz_cookies': ], $tbl_check->errstr)
1841 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;}")
1843 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;}")
1852 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")
1854 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")
1877 0 0 scalar @$missing or scalar @$bad_datatype
1892 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")
1894 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")
1897 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")
1907 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")
1912 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")
1934 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")
2016 0 0 $table_moz_cookies_exists //= ""
2114 0 0 $opts->{'file'} //= ""
2115 0 0 $opts->{'skip_discard'} //= 0
2116 0 0 $opts->{'skip_expired'} //= 0
2118 0 0 $self->new_file($opts->{'file'}) || (return $self->pass_error)
2119 0 0 $f->open('>', {'binmode', 'utf-8'}) || (return $self->error(qq[Unable to write cookies to file "$opts->{'file'}": ], $f->error))
2155 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 {
718 0 0 0 $opts->{'path'} eq "/" or substr($opts->{'path'}, -1, 1) eq "/"
845 8 0 0 $host //= $self->host || ''
874 4 0 0 $host eq $c_host || index(reverse($host), reverse(".$c_host")) == 0
919 12 0 0 $dom eq $host or $opts->{'with_subdomain'} and $host =~ /\.$dom$/
971 0 1 0 $opts->{'iv'} //= $self->_initialisation_vector->scalar || ''
1035 3 0 0 $self->make($def) || do {
1052 0 1 0 $opts->{'iv'} //= $self->_initialisation_vector->scalar || ''
1137 0 0 0 $opts->{'use_dbi'} || $opts->{'sqlite'}
0 0 0 $requires_dbi or not $opts->{'use_dbi'} || $opts->{'sqlite'}
1216 0 0 0 scalar @$cookies or $requires_dbi
1321 0 0 0 $opts->{'host'} //= $self->host || ''
1450 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
1512 0 1 0 $opts->{'iv'} //= $self->_initialisation_vector->scalar || ''
1586 0 1 0 $opts->{'iv'} //= $self->_initialisation_vector->scalar || ''
1774 0 0 0 $opts->{'use_dbi'} || $opts->{'sqlite'}
0 0 0 $requires_dbi or not $opts->{'use_dbi'} || $opts->{'sqlite'}
1969 0 0 0 defined $dbi_error and not $requires_dbi or exists $opts->{'sqlite'} and defined $opts->{'sqlite'} and CORE::length $opts->{'sqlite'}
2252 0 0 0 $x eq '2F' || $x eq '25'