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