Command/initdb.pm

filter: Statementstmt 52.6% 10 / 19 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 1 totaltotal 46.1% 12 / 26 CC 2 SCAR 11.1
CC
2
Cov
48%
run
6.0
__ANON__
1.1
BEGIN
1.0
CRAP 3.0
« Base.pm ↑ Summary Command/version.pm »
1 package PMLTQ::Command::initdb;
2 1 our $AUTHORITY = 'cpan:MATY';
3 1 $PMLTQ::Command::initdb::VERSION = '2.0.3';
4 # ABSTRACT: Initialize empty database
5  
6 1 ▶use PMLTQ::Base 'PMLTQ::Command';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use PMLTQ::Commands;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶has usage => sub { shift->extract_usage };
Subroutine __ANON__: not called CC=1 SCAR=1.2
10  
11  
12 0 ▶sub run {
Subroutine run: not called CC=2 SCAR=17.9
Pod undocumented
13 0 my $self = shift;
14  
15 0 my $config = $self->config;
16 0 my $dbh = $self->sys_db;
17  
18 0 ▶ $dbh->do("CREATE DATABASE \"$config->{db}->{name}\";") or die $dbh->errstr;
Branch: 1 branch
BranchTrueFalseTotal
$dbh->do(qq[CREATE DATABASE "$config->{"db"}{"name"}";]) or die $dbh->errstr 0 0 0
19 0 $dbh->disconnect;
20  
21 0 $dbh = $self->db;
22 0 $self->run_sql_from_file( 'init.sql', File::Spec->catfile( PMLTQ::Commands::shared_dir(), 'sql' ), $dbh );
23 0 $dbh->disconnect;
24 }
25  
26 =head1 SYNOPSIS
27  
28 pmltq initdb <treebank_config>
29  
30 =head1 DESCRIPTION
31  
32 Initialize empty database.
33  
34 =head1 OPTIONS
35  
36 =head1 PARAMS
37  
38 =over 5
39  
40 =item B<treebank_config>
41  
42 Path to configuration file. If a treebank_config is --, config is readed from STDIN.
43  
44 =back
45  
46 =cut
47  
48 1 1;
« Base.pm ↑ Summary Command/version.pm »