lib/App/Sandy/Command/Expression.pm

filter: Statementstmt 100% 3 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 4 / 4 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« lib/App/Sandy/Command/Citation.pm ↑ Summary lib/App/Sandy/Command/Expression/Add.pm »
1 package App::Sandy::Command::Expression;
2 # ABSTRACT: expression command class. Manage expression-matrix database.
3  
4 1 ▶use App::Sandy::Base 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 use App::Sandy::DB::Handle::Expression;
6 use Text::ASCIITable;
7  
8 extends 'App::Sandy::CLI::Command';
9  
10 our $VERSION = '0.25'; # VERSION
11  
12 has 'db' => (
13 is => 'ro',
14 isa => 'App::Sandy::DB::Handle::Expression',
15 builder => '_build_db',
16 lazy_build => 1,
17 handles => [qw/insertdb restoredb deletedb make_report retrievedb/]
18 );
19  
20 sub _build_db {
21 return App::Sandy::DB::Handle::Expression->new;
22 }
23  
24 override 'opt_spec' => sub {
25 super
26 };
27  
28 sub subcommand_map {
29 add => 'App::Sandy::Command::Expression::Add',
30 remove => 'App::Sandy::Command::Expression::Remove',
31 restore => 'App::Sandy::Command::Expression::Restore',
32 dump => 'App::Sandy::Command::Expression::Dump'
33 }
34  
35 sub validate_args {
36 my ($self, $args) = @_;
37 die "Too many arguments: '@$args'\n" if @$args;
38 }
39  
40 sub execute {
41 my ($self, $opts, $args) = @_;
42  
43 my $report_ref = $self->make_report;
44  
45 if (%$report_ref) {
46 my $t1 = Text::ASCIITable->new;
47 $t1->setCols('expression-matrix', 'source', 'provider', 'date');
48  
49 for my $expression_matrix (sort keys %$report_ref) {
50 my $attr = $report_ref->{$expression_matrix};
51 $t1->addRow($expression_matrix, $attr->{source}, $attr->{provider}, $attr->{date});
52 }
53  
54 print $t1;
55 }
56 }
57  
58 __END__
« lib/App/Sandy/Command/Citation.pm ↑ Summary lib/App/Sandy/Command/Expression/Add.pm »