Condition Coverage

blib/lib/HTTP/Cookies/Mozilla.pm
Criterion Covered Total %
condition 7 24 29.1


and 3 conditions

line !l l&&!r l&&r condition
193 20 0 0 $discard and not $self->{'ignore_discard'}
196 0 20 0 defined $expires and _now() > $expires

or 3 conditions

line l !l&&r !l&&!r condition
114 3 0 0 eval { do { require DBI; my $dbh = 'DBI'->connect('dbi:SQLite:dbname=' . $file, '', '', {'RaiseError', 1}); $cookies = $dbh->selectall_arrayref($query); $dbh->disconnect; 1 } } or eval { do { require 5.008; die $! unless open my $fh, '-|', $HTTP::Cookies::Mozilla::SQLITE, $file, $query; $cookies = [map({[split(/\|/, $_, 0)];} readline $fh)]; 1 } }
133 5 0 0 $self->{'file'} || do { carp('load() did not get a filename!'); return }
0 5 0 $file ||= $self->{'file'} || do { carp('load() did not get a filename!'); return }
276 1 0 0 eval { do { require DBI; my $dbh = 'DBI'->connect('dbi:SQLite:dbname=' . $file, '', '', {'RaiseError', 1, 'AutoCommit', 0}); $dbh->do('DROP TABLE IF EXISTS moz_cookies;'); $dbh->do('CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER);'); { my $pholds = join(', ', ('?') x @fnames); my $sth = $dbh->prepare("INSERT INTO moz_cookies($fnames) VALUES ($pholds)"); $self->scan($self->_scansub_maker(sub { my($domain, $path, $key, $val, $secure, $expires) = @_; $secure = $secure ? 1 : 0; $sth->execute($domain, $path, $key, $val, $secure, $expires); } )); $sth->finish; } ; $dbh->commit; $dbh->disconnect; 1 } } or eval { do { die $! unless open my $fh, '|-', $HTTP::Cookies::Mozilla::SQLITE, $file; print {$fh;} "\nBEGIN TRANSACTION;\n\nDROP TABLE IF EXISTS moz_cookies;\nCREATE TABLE moz_cookies\n (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT,\n path TEXT,expiry INTEGER, lastAccessed INTEGER,\n isSecure INTEGER, isHttpOnly INTEGER);\n\n"; $self->scan($self->_scansub_maker(sub { my($domain, $path, $key, $val, $secure, $expires) = @_; $secure = $secure ? 1 : 0; my $values = join(', ', map({my $hex = unpack('H*', $_); "X'${hex}'";} $domain, $path, $key, $val, $secure, $expires)); print {$fh;} "INSERT INTO moz_cookies( $fnames ) VALUES ( $values );\n"; } )); print {$fh;} "\nUPDATE moz_cookies SET lastAccessed = id;\nEND TRANSACTION;\n\n"; 1 } }
287 0 0 0 $self->{'file'} || do { carp('save() did not get a filename!'); return }
4 0 0 $file ||= $self->{'file'} || do { carp('save() did not get a filename!'); return }