3 |
use strict; |
use strict; |
4 |
use blib; |
use blib; |
5 |
|
|
6 |
use Test::More tests => 49; |
use Test::More tests => 75; |
7 |
|
|
8 |
BEGIN { |
BEGIN { |
9 |
use_ok( 'WebPAC::Test' ); |
use_ok( 'WebPAC::Test' ); |
22 |
our ($db,$size); |
our ($db,$size); |
23 |
|
|
24 |
sub open_xls { |
sub open_xls { |
25 |
my $args = shift; |
my $path = shift || die "no path?"; |
26 |
|
$path = "$abs_path/data/$path"; |
27 |
$args->{path} = "$abs_path/data/" . $args->{path} || die "no path?"; |
ok(my $db = $input->open( path => $path ), "open $path"); |
|
ok(my $db = $input->open( %$args ), "open " . dump( $args )); |
|
28 |
ok($size = $input->size, "size $size"); |
ok($size = $input->size, "size $size"); |
29 |
return $db; |
return $db; |
30 |
} |
} |
31 |
|
|
32 |
open_xls({ path => 'excel_95.xls' }); |
open_xls('excel_95.xls'); |
33 |
|
|
34 |
foreach my $mfn ( 1 ... $size ) { |
foreach my $mfn ( 1 ... $size ) { |
35 |
my $rec = $input->fetch; |
my $rec = $input->fetch; |
44 |
diag "rec: ", dump($rec), "\n" if $debug; |
diag "rec: ", dump($rec), "\n" if $debug; |
45 |
} |
} |
46 |
|
|
47 |
open_xls({ path => 'stara-signatura.xls', input_encoding => 'utf-16' }); |
open_xls('stara-signatura.xls'); |
48 |
ok( $input->seek( 790 ), 'seek 790'); |
for ( 1 .. 14 ) { |
49 |
ok( my $rec = $input->fetch, 'fetch' ); |
ok( $input->seek( $_ ), "seek $_"); |
50 |
diag dump( $rec ); |
ok( my $rec = $input->fetch, "fetch $_" ); |
51 |
|
diag dump( $rec ) if $debug; |
52 |
|
} |
53 |
|
|