Simple.pm

filter: Statementstmt 52.7% 19 / 36 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 41.3% 24 / 58 CC 9 SCAR 41.4
CC
9
Cov
37%
read_table
90.0
BEGIN
1.0
BEGIN
1.0
CRAP 62.6
« Binary.pm ↑ Summary Base.pm »
1 package Astro::STSDAS::Table::Simple;
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 ▶use Astro::STSDAS::Table::Binary;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 require Exporter;
11  
12 1 our @ISA = qw(Exporter);
13  
14 1 our %EXPORT_TAGS = ( 'all' => [ qw(
15 read_binary
16 ) ] );
17  
18 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
19  
20 1 our $VERSION = '0.01';
21  
22  
23 sub read_table
24 0 ▶{
Subroutine read_table: not called CC=9 SCAR=45.0
Pod documented
25 0 my ( $file, %uattr ) = @_;
26  
27  
28 0 my %attr = ( input => 'Binary',
29 output => 'RowHash',
30 );
31  
32 0 my ( $key, $val );
33 0 ▶ $attr{lc $key} = $val while( ( $key, $val ) = each %uattr );
Branch: 1 branch
BranchTrueFalseTotal
() = each %uattr and do { $attr{lc $key} = $val } 0 0 0
34  
35 0 my $input = lc $attr{input};
36 0 my $output = lc $attr{output};
37
38 0 ▶ croak( __PACKAGE__, "->read_table: only binary tables are supported\n" )
Branch: 1 branch
BranchTrueFalseTotal
unless "binary" eq $input 0 0 0
39 unless 'binary' eq $input;
40  
41  
42 0 my $tbl;
43 0 ▶ if ( 'binary' eq $input )
Branch: 1 branch
BranchTrueFalseTotal
if ("binary" eq $input) 0 0 0
44 {
45 0 $tbl = Astro::STSDAS::Table::Binary->new;
46 }
47  
48 0 ▶ $tbl->open( $file ) or
Branch: 1 branch
BranchTrueFalseTotal
$tbl->open($file) or croak(__PACKAGE__, "::read_table: unable to open $file\n") 0 0 0
49 croak( __PACKAGE__, "::read_table: unable to open $file\n" );
50  
51 0 ▶ if ( 'rowhash' eq $output )
Branch: 4 branches
BranchTrueFalseTotal
if ('rowhash' eq $output) { } 0 0 0
elsif ('colhash' eq $output) { } 0 0 0
elsif ('rowarray' eq $output) { } 0 0 0
elsif ('rowarray' eq $output) { } 0 0 0
52 {
53 0 $tbl->read_rows_hash
54 }
55 elsif ( 'colhash' eq $output )
56 {
57 0 $tbl->read_cols_hash
58 }
59 elsif ( 'rowarray' eq $output )
60 {
61 0 $tbl->read_rows_array
62 }
63 elsif ( 'rowarray' eq $output )
64 {
65 0 $tbl->read_rows_array
66 }
67 else
68 {
69 0 croak( __PACKAGE__,
70 "::read_table: unknown output type: $attr{output}\n" );
71 }
72 }
73  
74 1 1;
75  
76 __END__
« Binary.pm ↑ Summary Base.pm »