Commit | Line | Data |
b6bc5a5d |
1 | package Spreadsheet::WriteExcel; |
2 | |
3 | use strict; |
4 | |
5 | use mock; |
6 | use Spreadsheet::WriteExcel::Worksheet; |
7 | |
8 | sub new { |
9 | my $self = bless { |
10 | }, shift; |
11 | |
12 | { |
13 | local $" = "', '"; |
9d172425 |
14 | push @mock::calls, ref($self) . "::new( '@_' )"; |
b6bc5a5d |
15 | } |
16 | |
e976988f |
17 | $self->{file} = shift; |
18 | |
b6bc5a5d |
19 | return $self; |
20 | } |
21 | |
22 | sub close { |
9d172425 |
23 | my $self = shift; |
b6bc5a5d |
24 | { |
25 | local $" = "', '"; |
9d172425 |
26 | push @mock::calls, ref($self) . "::close( '@_' )"; |
b6bc5a5d |
27 | } |
e976988f |
28 | |
29 | if ( ref $self->{file} ) { |
30 | my $fh = $self->{file}; |
31 | print $fh join "\n", @mock::calls, ''; |
32 | } |
b6bc5a5d |
33 | } |
34 | |
35 | sub add_worksheet { |
9d172425 |
36 | my $self = shift; |
b6bc5a5d |
37 | { |
38 | local $" = "', '"; |
9d172425 |
39 | push @mock::calls, ref($self) . "::add_worksheet( '@_' )"; |
b6bc5a5d |
40 | } |
41 | return Spreadsheet::WriteExcel::Worksheet->new; |
42 | } |
43 | |
44 | my $format_num = 1; |
45 | sub add_format { |
9d172425 |
46 | my $self = shift; |
b6bc5a5d |
47 | my %x = @_; |
48 | my @x = map { $_ => $x{$_} } sort keys %x; |
49 | { |
50 | local $" = "', '"; |
9d172425 |
51 | push @mock::calls, ref($self) . "::add_format( '@x' )"; |
b6bc5a5d |
52 | } |
53 | return $format_num++; |
54 | } |
55 | |
56 | 1; |
57 | __END__ |