File: 17-gh7-OrderBySheet.t

package info (click to toggle)
libspreadsheet-readsxc-perl 0.39-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,368 kB
  • sloc: perl: 1,377; makefile: 8; xml: 2
file content (27 lines) | stat: -rw-r--r-- 785 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 1;
use File::Basename 'dirname';
use Spreadsheet::ReadSXC qw(read_sxc);
#use Data::Dumper;

my $d = dirname($0);
my $file = "$d/merged.ods";

my $book_h_ref = read_sxc( $file );
use Data::Dumper;
print Dumper [ map { $book_h_ref->{$_} } sort keys %$book_h_ref ];
# Output:
# $VAR1 = [ [ [ 'a1', 'b1' ], [ 'a2', 'b2' ] ], [ [ 'A1', 'B1' ], [ 'A2', 'B2' ] ] ];


my $book_a_ref = read_sxc( $file, { OrderBySheet => 1 } );

isnt $book_a_ref->[0], undef, "When ordering by sheet name, we don't lose the sheets";

use Data::Dumper; print Dumper $book_a_ref;
# Output original:
# $VAR1 = [ undef, undef ];
# Output with applied patch:
# $VAR1 = [ [ [ 'a1', 'b1' ], [ 'a2', 'b2' ] ], [ [ 'A1', 'B1' ], [ 'A2', 'B2' ] ] ];