Improved tests and documentation. Fixed a few bugs in register()
[p5sagit/Excel-Template.git] / t / Spreadsheet / WriteExcel.pm
CommitLineData
b6bc5a5d 1package Spreadsheet::WriteExcel;
2
3use strict;
4
5use mock;
6use Spreadsheet::WriteExcel::Worksheet;
7
8sub 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
22sub 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
35sub 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
44my $format_num = 1;
45sub 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
561;
57__END__