Improved tests and documentation. Fixed a few bugs in register()
[p5sagit/Excel-Template.git] / t / Spreadsheet / WriteExcel.pm
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 $" = "', '";
14         push @mock::calls, ref($self) . "::new( '@_' )";
15     }
16
17     $self->{file} = shift;
18
19     return $self;
20 }
21
22 sub close {
23     my $self = shift;
24     {
25         local $" = "', '";
26         push @mock::calls, ref($self) . "::close( '@_' )";
27     }
28
29     if ( ref $self->{file} ) {
30         my $fh = $self->{file};
31         print $fh join "\n", @mock::calls, ''; 
32     }
33 }
34
35 sub add_worksheet {
36     my $self = shift;
37     {
38         local $" = "', '";
39         push @mock::calls, ref($self) . "::add_worksheet( '@_' )";
40     }
41     return Spreadsheet::WriteExcel::Worksheet->new;
42 }
43
44 my $format_num = 1;
45 sub add_format {
46     my $self = shift;
47     my %x = @_;
48     my @x = map { $_ => $x{$_} } sort keys %x;
49     {
50         local $" = "', '";
51         push @mock::calls, ref($self) . "::add_format( '@x' )";
52     }
53     return $format_num++;
54 }
55
56 1;
57 __END__