| 1 | #!perl | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use version; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 10 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use Getopt::Long; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 10 | ▶ | use List::Util 'max'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use Pod::Usage; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 10 | ▶ | use Readonly; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 10 | ▶ | use Text::Autoformat 'autoformat'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | use Text::RecordParser; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | 10 | ▶ | use Text::TabularDisplay; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 10 | Readonly our $VERSION => 1.15; | |||||||||||||||||||||||||||||||
| 16 | 10 | Readonly my $DASH => q{-}; | |||||||||||||||||||||||||||||||
| 17 | 10 | Readonly my $EMPTY_STR => q{}; | |||||||||||||||||||||||||||||||
| 18 | 10 | Readonly my $TAB => qq{\t}; | |||||||||||||||||||||||||||||||
| 19 | 10 | Readonly my $NEWLINE => qq{\n}; | |||||||||||||||||||||||||||||||
| 20 | 10 | Readonly my $WIDTH => 78; | |||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | 10 | my $comment_start = ''; | |||||||||||||||||||||||||||||||
| 23 | 10 | my $fs = $TAB; | |||||||||||||||||||||||||||||||
| 24 | 10 | my $rs = $NEWLINE; | |||||||||||||||||||||||||||||||
| 25 | 10 | my $headers = ''; | |||||||||||||||||||||||||||||||
| 26 | 10 | my $no_headers = 0; | |||||||||||||||||||||||||||||||
| 27 | 10 | my $show_vertically = 0; | |||||||||||||||||||||||||||||||
| 28 | 10 | my $no_pager = 0; | |||||||||||||||||||||||||||||||
| 29 | 10 | my $strip_quotes = 0; | |||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 10 | my ( $show_fields, $list, $limit, @where, $help, $man_page, $show_version ); | |||||||||||||||||||||||||||||||
| 32 | 10 | ▶ | GetOptions( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 33 | 'c|comment:s' => \$comment_start, | ||||||||||||||||||||||||||||||||
| 34 | 'fs:s' => \$fs, | ||||||||||||||||||||||||||||||||
| 35 | 'rs:s' => \$rs, | ||||||||||||||||||||||||||||||||
| 36 | 'f|fields:s' => \$show_fields, | ||||||||||||||||||||||||||||||||
| 37 | 'l|list' => \$list, | ||||||||||||||||||||||||||||||||
| 38 | 'i|limit:i' => \$limit, | ||||||||||||||||||||||||||||||||
| 39 | 'w|where:s' => \@where, | ||||||||||||||||||||||||||||||||
| 40 | 'v|vertical' => \$show_vertically, | ||||||||||||||||||||||||||||||||
| 41 | 'strip-quotes' => \$strip_quotes, | ||||||||||||||||||||||||||||||||
| 42 | 'n|no-headers' => \$no_headers, | ||||||||||||||||||||||||||||||||
| 43 | 'h|headers:s' => \$headers, | ||||||||||||||||||||||||||||||||
| 44 | 'no-pager' => \$no_pager, | ||||||||||||||||||||||||||||||||
| 45 | 'help' => \$help, | ||||||||||||||||||||||||||||||||
| 46 | 'man' => \$man_page, | ||||||||||||||||||||||||||||||||
| 47 | 'version' => \$show_version, | ||||||||||||||||||||||||||||||||
| 48 | ) or pod2usage; | ||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | 10 | ▶ | if ( $help || $man_page ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$help or $man_page
MC/DC0%0/2
$help or $man_page
$help
$man_page
Truth table33%1/3
A or B
A= $helpB= $man_page
| |||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | pod2usage({ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 52 | -exitval => 0, | ||||||||||||||||||||||||||||||||
| 53 | -verbose => $man_page ? 2 : 1 | ||||||||||||||||||||||||||||||||
| 54 | }); | ||||||||||||||||||||||||||||||||
| 55 | }; | ||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||
| 57 | 10 | ▶ | if ( $show_version ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 58 | 0 | my $prog = basename( $0 ); | |||||||||||||||||||||||||||||||
| 59 | 0 | print "$prog $VERSION\n"; | |||||||||||||||||||||||||||||||
| 60 | 0 | exit 0; | |||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||
| 63 | 10 | ▶ | my $file = shift or pod2usage('No file'); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 64 | 10 | ▶ | my $p = Text::RecordParser->new( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 65 | field_separator => $fs, | ||||||||||||||||||||||||||||||||
| 66 | record_separator => $rs, | ||||||||||||||||||||||||||||||||
| 67 | comment => $comment_start ? qr/^$comment_start/ : undef, | ||||||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | 10 | ▶ | if ( $strip_quotes ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | $p->field_filter( sub { s/^["']//; s/["']$//; $_ } ); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||
| 74 | 10 | ▶ | if ( $file eq $DASH ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 75 | 0 | $p->fh( \*STDIN ); | |||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||
| 77 | else { | ||||||||||||||||||||||||||||||||
| 78 | 10 | $p->filename( $file ); | |||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | 10 | my @fields; | |||||||||||||||||||||||||||||||
| 82 | 10 | ▶ | if ( @fields = split( /\s*,\s*/, $headers ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 83 | 0 | $p->bind_fields( @fields ); | |||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||
| 85 | elsif ( !$no_headers ) { | ||||||||||||||||||||||||||||||||
| 86 | 8 | $p->bind_header; | |||||||||||||||||||||||||||||||
| 87 | 8 | @fields = $p->field_list; | |||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||
| 90 | 10 | ▶ | if ( $list ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 91 | 1 | ▶ | pod2usage(q[Can't list fields with --no-headers]) if $no_headers; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 92 | 1 | my $tab = Text::TabularDisplay->new('Field No.', 'Field'); | |||||||||||||||||||||||||||||||
| 93 | 1 | my $i = 1; | |||||||||||||||||||||||||||||||
| 94 | 1 | $tab->add( $i++, $_ ) for @fields; | |||||||||||||||||||||||||||||||
| 95 | 1 | print $tab->render, $NEWLINE; | |||||||||||||||||||||||||||||||
| 96 | 1 | exit 0; | |||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||
| 99 | 9 | my %where; | |||||||||||||||||||||||||||||||
| 100 | 9 | for ( @where ) { | |||||||||||||||||||||||||||||||
| 101 | 5 | ▶ | if ( /([\w\d]+)\s*(==|eq|>=?|<=?|=~)\s*(.*)/ ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 102 | 5 | my $field = $1; | |||||||||||||||||||||||||||||||
| 103 | 5 | my $op = $2; | |||||||||||||||||||||||||||||||
| 104 | 5 | my $value = $3; | |||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||
| 106 | 5 | ▶ | unless ( $no_headers ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 107 | 4 | my %available = map { $_, 1 } @fields; | |||||||||||||||||||||||||||||||
| 108 | 4 | ▶ | next unless $available{ $field }; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||
| 111 | 5 | ▶ | $field-- if $field =~ /^\d+$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 112 | 5 | $where{ $field } = [ $op, $value ]; | |||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||
| 116 | 9 | ▶ | if ( $show_fields ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 117 | 9 | ▶ | my @show = map { $_ =~ m/^\d+$/ && @fields | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$_ =~ /^\d+$/ and @fields
MC/DC50%1/2
$_ =~ /^\d+$/ and @fields
$_ =~ /^\d+$/
@fields
Truth table66%2/3
A and B
A= $_ =~ /^\d+$/B= @fields
| |||||||||||||||||||||||||||||||||
| 118 | ? $_-1 < scalar @fields ? $_ : () : $_ } | ||||||||||||||||||||||||||||||||
| 119 | 4 | ▶ | map { $_ =~ m/(\d+)-(\d+)/ ? ( $1..$2 ) : $_ } | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 120 | split /,/, $show_fields; | ||||||||||||||||||||||||||||||||
| 121 | 4 | my @numbers = grep { /^(\d+)$/ } @show; | |||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||
| 123 | 4 | ▶ | if ( $no_headers ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 124 | 0 | @fields = @show; | |||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||
| 126 | else { | ||||||||||||||||||||||||||||||||
| 127 | 4 | ▶ | if ( scalar @show == scalar @numbers ) { # all numbers | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 128 | 1 | @numbers = map { $_ - 1 } @numbers; | |||||||||||||||||||||||||||||||
| 129 | 1 | @fields = @fields[ @numbers ]; | |||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||
| 131 | elsif ( @show ) { | ||||||||||||||||||||||||||||||||
| 132 | 3 | my %available = map { $_, 1 } @fields; | |||||||||||||||||||||||||||||||
| 133 | 3 | my @temp = @fields; | |||||||||||||||||||||||||||||||
| 134 | 3 | ▶ | @fields = map { $available{ $_ } ? $_ : () } @show; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||
| 137 | 4 | ▶ | if ( !@fields ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 138 | 0 | die "No fields match in list '$show_fields'\n"; | |||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||
| 143 | 9 | my $fh; | |||||||||||||||||||||||||||||||
| 144 | 9 | my $pager = $ENV{'PAGER'}; | |||||||||||||||||||||||||||||||
| 145 | 9 | ▶ | if ( !$no_pager && $pager ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $no_pager and $pager
MC/DC0%0/2
not $no_pager and $pager
not $no_pager
$pager
Truth table33%1/3
not(A) and B
A= not $no_pagerB= $pager
| |||||||||||||||||||||||||||||||||
| 146 | 0 | open $fh, "| $pager"; | |||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||
| 148 | else { | ||||||||||||||||||||||||||||||||
| 149 | 9 | $fh = \*STDOUT; | |||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||
| 152 | 9 | my $tab = Text::TabularDisplay->new( @fields ); | |||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||
| 154 | 9 | my $max_col_length = 0; | |||||||||||||||||||||||||||||||
| 155 | 9 | my $num_records = 0; | |||||||||||||||||||||||||||||||
| 156 | 9 | my $separator = "************ Record %s ************\n"; | |||||||||||||||||||||||||||||||
| 157 | 9 | ▶ | if ( $no_headers ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 158 | 2 | my @field_names; | |||||||||||||||||||||||||||||||
| 159 | RECORD: | ||||||||||||||||||||||||||||||||
| 160 | 2 | ▶ | while ( my @data = $p->fetchrow_array ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 161 | 6 | ▶ | if ( !@fields ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 162 | 2 | @fields = ( 0..$#data ); | |||||||||||||||||||||||||||||||
| 163 | 2 | @field_names = map { 'Field' . ($_+1) } @fields; | |||||||||||||||||||||||||||||||
| 164 | 2 | $max_col_length = max( map { length $_ } @field_names ); | |||||||||||||||||||||||||||||||
| 165 | 2 | $tab->columns( @field_names ); | |||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||
| 168 | 6 | for my $field ( keys %where ) { | |||||||||||||||||||||||||||||||
| 169 | 5 | my ( $op, $value ) = @{ $where{ $field } }; | |||||||||||||||||||||||||||||||
| 170 | 5 | my $cmd = "'$data[ ($field - 1) ]' $op $value"; | |||||||||||||||||||||||||||||||
| 171 | 5 | ▶ | next RECORD unless eval $cmd; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||
| 174 | 4 | $num_records++; | |||||||||||||||||||||||||||||||
| 175 | 4 | ▶ | if ( $show_vertically ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 176 | 1 | printf $fh $separator, $num_records; | |||||||||||||||||||||||||||||||
| 177 | 1 | for my $i ( @fields ) { | |||||||||||||||||||||||||||||||
| 178 | 5 | ▶ | printf $fh "%${max_col_length}s: %s\n", | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 179 | $field_names[ $i ], | ||||||||||||||||||||||||||||||||
| 180 | defined $data[ $i ] ? $data[ $i ] : q{}; | ||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||
| 183 | else { | ||||||||||||||||||||||||||||||||
| 184 | 3 | $tab->add( map { $data[ $_ ] } @fields ); | |||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||
| 187 | 4 | ▶ | last if $limit && $num_records >= $limit; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$limit and $num_records >= $limit
MC/DC50%1/2
$limit and $num_records >= $limit
$limit
$num_records >= $limit
Truth table66%2/3
A and B
A= $limitB= $num_records >= $limit
| |||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||
| 190 | else { | ||||||||||||||||||||||||||||||||
| 191 | 7 | ▶ | $max_col_length = max map { $_ ? length $_ : 0 } $p->field_list; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||
| 193 | RECORD: | ||||||||||||||||||||||||||||||||
| 194 | 7 | ▶ | while ( my $data = $p->fetchrow_hashref ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 195 | 32 | for my $field ( keys %where ) { | |||||||||||||||||||||||||||||||
| 196 | 18 | my ( $op, $value ) = @{ $where{ $field } }; | |||||||||||||||||||||||||||||||
| 197 | 18 | my $cmd = "'$data->{ $field }' $op $value"; | |||||||||||||||||||||||||||||||
| 198 | 18 | ▶ | next RECORD unless eval $cmd; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||
| 201 | 22 | $num_records++; | |||||||||||||||||||||||||||||||
| 202 | 22 | ▶ | if ( $show_vertically ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 203 | 5 | printf $fh $separator, $num_records; | |||||||||||||||||||||||||||||||
| 204 | 5 | for my $field ( @fields ) { | |||||||||||||||||||||||||||||||
| 205 | 25 | ▶ | next unless $field; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 206 | 25 | ▶ | my $v = defined $data->{ $field } ? $data->{ $field } : q{}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 207 | 25 | ▶ | if ( length $v > $WIDTH ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 208 | 0 | ( $v = autoformat( $v, { left => $max_col_length + 3 } ) ) | |||||||||||||||||||||||||||||||
| 209 | =~ s/^\s+|\s+$//g; | ||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||
| 212 | 25 | printf $fh "%${max_col_length}s: %s\n", $field, $v; | |||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||
| 215 | else { | ||||||||||||||||||||||||||||||||
| 216 | 17 | $tab->add( map { $data->{ $_ } } @fields ); | |||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||
| 218 | 22 | ▶ | last if $limit && $num_records >= $limit; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$limit and $num_records >= $limit
MC/DC100%2/2
$limit and $num_records >= $limit
$limit
$num_records >= $limit
Truth table100%3/3
A and B
A= $limitB= $num_records >= $limit
| |||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||
| 222 | 9 | ▶ | if ( !$show_vertically ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 223 | 7 | print $fh $tab->render; | |||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||
| 226 | 9 | ▶ | print $fh $num_records | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 227 | ? sprintf( | ||||||||||||||||||||||||||||||||
| 228 | "\n%s record%s returned\n", $num_records, $num_records > 1 | ||||||||||||||||||||||||||||||||
| 229 | ? 's' : $EMPTY_STR | ||||||||||||||||||||||||||||||||
| 230 | ) | ||||||||||||||||||||||||||||||||
| 231 | : "\nNo records returned\n"; | ||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||
| 233 | 9 | close $fh; | |||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||
| 235 | __END__ | ||||||||||||||||||||||||||||||||