blib/lib/Win32/Access2Text.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 package Win32::Access2Text;
2
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 0 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=2.6
6
7 our $VERSION = '0.03';
8
9 BEGIN {
10 use Exporter;
11 our @ISA = qw( Exporter );
12 our @EXPORT = qw( );
13 our %EXPORT_TAGS = ( );
14 our @EXPORT_OK = qw( &AccTabSaveToText );
15 }
16
17 sub AccTabSaveToText($$$$) {
18
19 my ($connectionString, $fileMdb, $tabMdb, $fileTxt) = (shift, shift, shift, shift);
20
21 my $connect = DBI->connect("dbi:ADO:Data Source=".$fileMdb.$connectionString, "");
22 my $selectAll = $connect->selectall_arrayref("SELECT * FROM [$tabMdb]");
23
24 open(my $fhTxt, ">", $fileTxt) or die $!;
25
26 foreach my $row ( @{$selectAll} ) {
27 print $fhTxt join("\t", map {defined $_?$_:''} @{$row})."\n";
28 } # foreach
29
30 close($fhTxt) or die $!;
31
32 $fileTxt;
33
34 } # AccTabSaveToText
35
36 1;
37 __END__
↑ Summary