Branch Coverage

blib/lib/ACME/QuoteDB/LoadDB.pm
Criterion Covered Total %
branch 72 136 52.9


line true false branch
70 0 13 if (ref $$self{'category'} eq 'ARRAY') { }
81 1 12 if ($ENV{'ACME_QUOTEDB_DB'})
88 12 1 unless ($$args{'dry_run'})
90 10 3 if ($$args{'create_db'})
100 1502 67 if ($value)
118 0 5082 unless ($field)
126 0 9 if ($$self{'file'} and $$self{'data'} and $$self{'dir'}) { }
0 9 elsif (not $$self{'file'} || $$self{'data'} || $$self{'dir'}) { }
133 8 1 if ($$self{'file'}) { }
0 1 elsif ($$self{'data'}) { }
1 0 elsif ($$self{'dir'}) { }
147 0 1 unless ($e)
159 0 12 unless (-f $file)
161 0 12 if ($$self{'verbose'})
163 7 5 if ($$self{'file_format'} eq 'csv' or $$self{'file_format'} eq 'tsv') { }
5 0 elsif ($$self{'file_format'} eq 'html' or $$self{'file_format'} eq 'custom') { }
181 0 0 unless ($data)
183 0 0 if ($$self{'verbose'})
185 0 0 if ($$self{'file_format'} =~ /(?:csv|tsv)/ms) { }
0 0 elsif ($$self{'file_format'} eq 'html' or $$self{'file_format'} eq 'custom') { }
205 0 0 unless return $$hr{'quote'} eq 'Quote' && $$hr{'name'} eq 'Attribution Name' && $$hr{'source'} eq 'Attribution Source' && $$hr{'catg'} eq 'Category' && $$hr{'rating'} eq 'Rating'
228 0 182 unless $$hr{'quote'} and $$hr{'name'}
230 0 182 if ($$self{'verbose'})
248 0 7 unless close $source
266 1 1559 if (ref $val eq 'ARRAY') { }
268 6 6 unless (is_utf8 $v)
274 1509 50 unless (is_utf8 $val)
294 0 3374 unless $c_obj->name
295 190 3184 if ($c_obj->name eq $self->get_record('name'))
310 0 338 unless $c_obj->catg
311 280 58 if ($c_obj->catg eq $ctg)
325 0 312 if ($$self{'verbose'} and $self->get_record('name'))
331 122 190 unless ($attr_id)
333 93 29 if ($$self{'write_db'})
341 283 29 if ($$self{'write_db'})
343 282 1 if (not ref $catg) { }
1 0 elsif (ref $catg eq 'ARRAY') { }
345 9 273 unless ($catg_id)
355 5 7 unless ($catg_id)
366 283 29 if ($$self{'write_db'})
367 0 283 unless my $qid = 'ACME::QuoteDB::DB::Quote'->insert({'attr_id', $attr_id, 'quote', $self->get_record('quote'), 'source', $self->get_record('source'), 'rating', $self->get_record('rating')})
374 283 0 if ($qid)
377 0 294 unless $id = 'ACME::QuoteDB::DB::QuoteCatg'->insert({'quot_id', $qid, 'catg_id', $cid})
386 0 312 if ($$self{'write_db'} and not $attr_id)
392 283 29 if ($$self{'write_db'})
405 0 312 if (ref $$self{'orig_args'}{'category'} eq 'ARRAY') { }
427 0 312 if ($$self{'verbose'})
449 1 9 if ($$self{'db'} and $$self{'host'}) { }
512 0 0 unless $dbh->do('DROP TABLE IF EXISTS quote;')
514 0 0 unless $dbh->do("CREATE TABLE IF NOT EXISTS quote (\n quot_id INTEGER NOT NULL AUTO_INCREMENT, \n attr_id INTEGER,\n quote TEXT,\n source TEXT,\n rating REAL,\n PRIMARY KEY(quot_id)\n );")
526 0 0 unless $dbh->do('DROP TABLE IF EXISTS attribution;')
528 0 0 unless $dbh->do("CREATE TABLE IF NOT EXISTS attribution (\n attr_id INTEGER NOT NULL AUTO_INCREMENT,\n name TEXT,\n PRIMARY KEY(attr_id)\n );")
534 0 0 unless $dbh->do('DROP TABLE IF EXISTS category;')
536 0 0 unless $dbh->do("CREATE TABLE IF NOT EXISTS category (\n catg_id INTEGER NOT NULL AUTO_INCREMENT, \n catg TEXT,\n PRIMARY KEY(catg_id)\n );")
542 0 0 unless $dbh->do('DROP TABLE IF EXISTS quote_catg;')
544 0 0 unless $dbh->do("CREATE TABLE IF NOT EXISTS quote_catg (\n id INTEGER NOT NULL AUTO_INCREMENT, \n catg_id INTEGER, \n quot_id INTEGER, \n PRIMARY KEY(id)\n );")
552 0 0 unless $dbh->disconnect
557 0 0 if return $@
573 0 9 unless $dbh->do('DROP TABLE IF EXISTS quote;')
575 0 9 unless $dbh->do("CREATE TABLE IF NOT EXISTS quote (\n quot_id INTEGER PRIMARY KEY, \n attr_id INTEGER,\n quote TEXT,\n source TEXT,\n rating REAL\n );")
584 0 9 unless $dbh->do('DROP TABLE IF EXISTS attribution;')
586 0 9 unless $dbh->do("CREATE TABLE IF NOT EXISTS attribution (\n attr_id INTEGER PRIMARY KEY,\n name TEXT\n );")
591 0 9 unless $dbh->do('DROP TABLE IF EXISTS category;')
593 0 9 unless $dbh->do("CREATE TABLE IF NOT EXISTS category (\n catg_id INTEGER PRIMARY KEY, \n catg TEXT\n );")
598 0 9 unless $dbh->do('DROP TABLE IF EXISTS quote_catg;')
600 0 9 unless $dbh->do("CREATE TABLE IF NOT EXISTS quote_catg (\n id INTEGER PRIMARY KEY,\n catg_id INTEGER,\n quot_id INTEGER\n );")
606 0 9 unless $dbh->disconnect
611 0 0 if return $@