Branch Coverage

blib/lib/HTTP/Cookies/Mozilla.pm
Criterion Covered Total %
branch 20 38 52.6


line true false branch
110 0 0 unless open my $fh, '-|', $HTTP::Cookies::Mozilla::SQLITE, $file, $query
114 0 3 unless (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 } })
138 3 2 if $file =~ /\.sqlite/i
144 0 2 unless (open $fh, '<:utf8', $file)
151 0 2 unless ($magic =~ /^\# HTTP Cookie File/)
158 6 12 if /^\s*\#/
159 2 10 if /^\s*$/
180 0 4 $^O eq 'MacOS' ? :
193 0 20 if $discard and not $self->{'ignore_discard'}
195 20 0 $expires ? :
196 0 20 if defined $expires and _now() > $expires
227 0 5 $secure ? :
240 0 0 unless open my $fh, '|-', $HTTP::Cookies::Mozilla::SQLITE, $file
256 0 0 $secure ? :
276 0 1 unless (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 } })
292 1 3 if $file =~ /\. sqlite/imsx
297 0 3 unless (open $fh, '>:utf8', $file)
313 0 15 $secure ? :
314 15 0 $domain =~ /^\./ ? :