| 1 | package CohortExplorer::Command::Describe; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = 0.14; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use base qw(CLI::Framework::Command); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use CLI::Framework::Exceptions qw( :all ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Exception::Class::TryCatch; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | #------- | ||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub usage_text { | ||||||||||||||||||||||||||
|
Subroutine
usage_text: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 0 | q{ | |||||||||||||||||||||||||||
| 15 | describe : show datasource description including the entity count | ||||||||||||||||||||||||||||
| 16 | }; | ||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub validate { | ||||||||||||||||||||||||||
|
Subroutine
validate: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 20 | 0 | my ( $self, $opts, @args ) = @_; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | if (@args) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 0 | throw_cmd_validation_exception( | |||||||||||||||||||||||||||
| 24 | error => 'No arguments are required to run this command' ); | ||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 29 | 0 | my ( $self, $opts, @args ) = @_; | |||||||||||||||||||||||||||
| 30 | 0 | my ( $ds, $verbose ) = @{ $self->cache->get('cache') }{qw/datasource verbose/}; | |||||||||||||||||||||||||||
| 31 | 0 | my ( @cols, @rows ); | |||||||||||||||||||||||||||
| 32 | 0 | my $table_info = $ds->table_info; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | # Get all table attributes using the last key in $tables, first column is always table name | ||||||||||||||||||||||||||||
| 35 | 0 | push @cols, 'table'; | |||||||||||||||||||||||||||
| 36 | 0 | for ( keys %{ $table_info->{ ( keys %$table_info )[-1] } } ) { | |||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ( $_ ne 'table' && $_ ne '__type__' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_ ne "table" and $_ ne "__type__"
MC/DC0%0/2
$_ ne "table" and $_ ne "__type__"
$_ ne "table"
$_ ne "__type__"
Truth table0%0/3
A and B
A= $_ ne "table"B= $_ ne "__type__"
| |||||||||||||||||||||||||||||
| 38 | 0 | push @cols, $_; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | 0 | push @rows, \@cols; | |||||||||||||||||||||||||||
| 42 | 0 | for my $t ( keys %$table_info ) { | |||||||||||||||||||||||||||
| 43 | 0 | push @rows, [ map { $table_info->{$t}{$_} } @cols ]; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | print STDERR "\nRendering datasource description ...\n\n" if $verbose; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | return { | ||||||||||||||||||||||||||||
| 48 | 0 | headingText => $ds->name | |||||||||||||||||||||||||||
| 49 | . ' datasource description (' | ||||||||||||||||||||||||||||
| 50 | . $ds->entity_count | ||||||||||||||||||||||||||||
| 51 | . ' entities)', | ||||||||||||||||||||||||||||
| 52 | rows => \@rows | ||||||||||||||||||||||||||||
| 53 | }; | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | #------- | ||||||||||||||||||||||||||||
| 57 | 1 | 1; | |||||||||||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||||||||||||