ParseExcel/SaveParser.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 57 CC 3 SCAR 11.7
CC
3
Cov
0%
Create
6.0
Parse
6.0
new
2.0
CRAP 3.2
1 package Spreadsheet::ParseExcel::SaveParser;
2  
3 ###############################################################################
4 #
5 # Spreadsheet::ParseExcel::SaveParser - Rewrite an existing Excel file.
6 #
7 # Used in conjunction with Spreadsheet::ParseExcel.
8 #
9 # Copyright (c) 2014 Douglas Wilson
10 # Copyright (c) 2009-2013 John McNamara
11 # Copyright (c) 2006-2008 Gabor Szabo
12 # Copyright (c) 2000-2006 Kawai Takanori
13 #
14 # perltidy with standard settings.
15 #
16 # Documentation after __END__
17 #
18  
19 use strict;
20 use warnings;
21  
22 use Spreadsheet::ParseExcel;
23 use Spreadsheet::ParseExcel::SaveParser::Workbook;
24 use Spreadsheet::ParseExcel::SaveParser::Worksheet;
25 use Spreadsheet::WriteExcel;
26 use base 'Spreadsheet::ParseExcel';
27  
28 our $VERSION = '0.66';
29  
30 ###############################################################################
31 #
32 # new()
33 #
34 sub new {
35  
36 my ( $package, %params ) = @_;
37 $package->SUPER::new(%params);
38 }
39  
40 ###############################################################################
41 #
42 # Create()
43 #
44 sub Create {
45  
46 my ( $self, $formatter ) = @_;
47  
48 #0. New $workbook
49 my $workbook = Spreadsheet::ParseExcel::Workbook->new();
50 $workbook->{SheetCount} = 0;
51  
52 # User specified formatter class.
53 if ($formatter) {
54 $workbook->{FmtClass} = $formatter;
55 }
56 else {
57 $workbook->{FmtClass} = Spreadsheet::ParseExcel::FmtDefault->new();
58 }
59  
60 return Spreadsheet::ParseExcel::SaveParser::Workbook->new($workbook);
61 }
62  
63 ###############################################################################
64 #
65 # Parse()
66 #
67 sub Parse {
68  
69 my ( $self, $sFile, $formatter ) = @_;
70  
71 my $workbook = $self->SUPER::Parse( $sFile, $formatter );
72  
73 return undef unless defined $workbook;
74 return Spreadsheet::ParseExcel::SaveParser::Workbook->new($workbook);
75 }
76  
77 ###############################################################################
78 #
79 # SaveAs()
80 #
81 sub SaveAs {
82  
83 my ( $self, $workbook, $filename ) = @_;
84  
85 $workbook->SaveAs($filename);
86 }
87  
88 1;
89  
90 __END__