File Coverage

blib/lib/ORDB/DebianModules/Generator.pm
Criterion Covered Total %
statement 6 16 37.5
branch 0 2 0.0
condition n/a
subroutine 2 3 66.6
pod 0 1 0.0
total 8 22 36.3


line stmt bran cond sub pod time code
1             package ORDB::DebianModules::Generator;
2              
3 1     1   27309 use Debian::ModuleList;
  1         49301  
  1         26  
4 1     1   22313 use DBI;
  1         27974  
  1         191  
5              
6             our $VERSION = '0.02';
7              
8             sub save {
9 0     0 0   my $file = shift;
10 0           my @list = Debian::ModuleList::list_modules();
11 0 0         unlink($file) if(-f $file);
12 0           my $dbh = DBI->connect("dbi:SQLite:dbname=" . $file,"","");
13 0           $dbh->do("CREATE TABLE debian_module ( module TEXT NOT NULL PRIMARY KEY );");
14 0           $sth = $dbh->prepare("INSERT INTO debian_module (module) VALUES (?);");
15 0           $sth->execute($_) foreach(@list);
16 0           $sth->finish();
17 0           $dbh->do("CREATE INDEX debian_module__module on debian_module ( module );");
18 0           $dbh->disconnect;
19             }
20              
21             =head1 NAME
22              
23             ORDB::DebianModules::Generator - generator for the database ORDB::DebianModules points to
24              
25             =cut
26              
27             1;