use Excel::Template::Base;
use vars qw ($VERSION @ISA);
- $VERSION = '0.23';
+ $VERSION = '0.33';
@ISA = qw( Excel::Template::Base );
}
my $self = shift;
# Allow an arbitrary number of hashrefs, so long as they're the first things # into param(). Put each one onto the end, de-referenced.
- push @_, %{shift @_} while UNIVERSAL::isa($_[0], 'HASH');
+ push @_, %{shift @_} while ref $_[0] eq 'HASH';
(@_ % 2)
&& die __PACKAGE__, "->param() : Odd number of parameters to param()\n";
my $xls = $self->{RENDERER}->new($filename)
|| die "Cannot create XLS in '$filename': $!\n";
- $self->_prepare_output($xls);
+ eval {
+ $self->_prepare_output($xls);
+ };
+print $@ if $@;
$xls->close;
+ return if $@;
+
return ~~1;
}
my $output;
tie *XLS, 'IO::Scalar', \$output;
- $self->write_file(\*XLS);
+ $self->write_file(\*XLS)
+ or return;
return $output;
}
if ( $node->isa( 'WORKBOOK' ) )
{
- push @{$self->{WORKBOOKS}}, $node;
+ $self->{WORKBOOK} = $node;
}
elsif ( $node->is_embedded )
{
return unless @stack;
-
+
if (exists $stack[-1]{TXTOBJ} &&
$stack[-1]{TXTOBJ}->isa('TEXTOBJECT'))
{
push @{$stack[-1]{TXTOBJ}{STACK}}, $node;
}
-
+
}
else
{
else
{
my ($filename, $dirname) = fileparse($file);
-
- push @parms, Base => $dirname;
- open( INFILE, "<$file" )
- || die "Cannot open '$file' for reading: $!\n";
+ push @parms, Base => $dirname;
+ eval q{
+ open( INFILE, '<', $file )
+ || die "Cannot open '$file' for reading: $!\n";
+ }; if ( $@ ) {
+ if ( $@ =~ /Too many arguments for open/ ) {
+ open( INFILE, "< $file" )
+ || die "Cannot open '$file' for reading: $!\n";
+ } else {
+ die $@;
+ }
+ }
}
my $parser = XML::Parser->new( @parms );
$parser->parse(do { local $/ = undef; <INFILE> });
- unless ( ref $file )
- {
- close INFILE;
- }
+ close INFILE
+ unless ref $file;
return ~~1;
}
-*parse = \&parse_xml;
+*parse = *parse = \&parse_xml;
sub _prepare_output
{
my $self = shift;
+ return unless $self->{WORKBOOK};
+
my ($xls) = @_;
my $context = Excel::Template::Factory->_create(
UNICODE => $self->{UNICODE},
);
- $_->render($context) for @{$self->{WORKBOOKS}};
+ $self->{WORKBOOK}->render($context);
return ~~1;
}
=item * L<ROW|Excel::Template::Container::Row>
-This node represents a row of data. This is the A in A1.
+This node represents a row of data. This is the 1 in A1. There is no COLUMN node, as of yet.
=item * L<FORMAT|Excel::Template::Container::Format>
This is production quality software, used in several production web applications.
-=head1 AUTHOR
+=head1 MAINTAINERS
- Rob Kinyon (rob.kinyon@gmail.com)
+ Jens Gassmann <jegade@cpan.org>
+ Robert Bohne <rbo@cpan.org>
+ Rob Kinyon <rkinyon@cpan.org>
=head1 CONTRIBUTORS
There is a mailing list at http://groups.google.com/group/ExcelTemplate or exceltemplate@googlegroups.com
+=head2 Robert Bohne <rbo@cpan.org>
+
+=over 4
+
+=item * Swichting to Module::Install
+
+=item * Add autofilter to worksheet
+
+=back
+
=head2 Robert Graff
=over 4
=back
+=head2 Jens Gassmann
+
+=over 4
+
+=item * Add hide_gridlines to worksheet
+
+=back
+
=head1 TEST COVERAGE
-I used L<Devel::Cover> to test the coverage of my tests. Every release, I intend to improve these numbers.
+I use L<Devel::Cover> to test the coverage of my tests. Every release, I intend to improve these numbers.
Excel::Template is also part of the CPAN Kwalitee initiative, being one of the top 100 non-core modules downloaded from CPAN. If you wish to help out, please feel free to contribute tests, patches, and/or suggestions.
- -----------------------------------------------------------------------
- File stmt brnch cond sub pod time total
- -----------------------------------------------------------------------
- blib/lib/Excel/Template.pm 96.0 62.5 58.8 100.0 100.0 25.2 86.2
- ...ib/Excel/Template/Base.pm 87.0 50.0 66.7 81.8 87.5 8.7 83.0
- ...cel/Template/Container.pm 71.4 50.0 33.3 70.0 80.0 4.9 68.4
- ...emplate/Container/Bold.pm 100.0 n/a n/a 100.0 0.0 0.7 95.0
- .../Container/Conditional.pm 64.9 57.5 66.7 100.0 0.0 0.7 63.9
- ...plate/Container/Format.pm 100.0 n/a n/a 100.0 0.0 0.7 96.6
- ...plate/Container/Hidden.pm 100.0 n/a n/a 100.0 0.0 0.1 95.0
- ...plate/Container/Italic.pm 100.0 n/a n/a 100.0 0.0 0.1 95.0
- ...plate/Container/Locked.pm 100.0 n/a n/a 100.0 0.0 0.1 95.0
- ...emplate/Container/Loop.pm 90.9 50.0 50.0 100.0 50.0 0.5 80.4
- ...late/Container/Outline.pm 100.0 n/a n/a 100.0 0.0 0.1 95.0
- ...Template/Container/Row.pm 100.0 75.0 n/a 100.0 50.0 0.3 93.8
- ...mplate/Container/Scope.pm 100.0 n/a n/a 100.0 n/a 0.1 100.0
- ...plate/Container/Shadow.pm 100.0 n/a n/a 100.0 0.0 0.1 95.0
- ...te/Container/Strikeout.pm 100.0 n/a n/a 100.0 0.0 0.1 95.0
- ...ate/Container/Workbook.pm 100.0 n/a n/a 100.0 n/a 0.9 100.0
- ...te/Container/Worksheet.pm 94.1 50.0 n/a 100.0 0.0 0.9 88.0
- ...Excel/Template/Context.pm 84.3 53.4 54.2 100.0 92.3 19.5 76.0
- ...Excel/Template/Element.pm 100.0 n/a n/a 100.0 n/a 0.5 100.0
- ...mplate/Element/Backref.pm 100.0 50.0 33.3 100.0 0.0 0.1 87.1
- .../Template/Element/Cell.pm 95.8 65.0 80.0 100.0 66.7 3.8 86.9
- ...mplate/Element/Formula.pm 100.0 n/a n/a 100.0 0.0 0.3 94.1
- ...Template/Element/Range.pm 100.0 66.7 n/a 100.0 66.7 0.2 93.3
- ...l/Template/Element/Var.pm 100.0 n/a n/a 100.0 0.0 0.1 94.1
- ...Excel/Template/Factory.pm 100.0 73.1 n/a 100.0 100.0 16.3 92.6
- .../Excel/Template/Format.pm 98.3 81.2 33.3 100.0 100.0 10.0 93.2
- ...xcel/Template/Iterator.pm 98.6 80.0 70.6 100.0 83.3 1.9 90.3
- ...el/Template/TextObject.pm 92.9 62.5 33.3 100.0 50.0 3.1 83.0
- Total 92.0 63.5 58.3 97.5 98.5 100.0 86.0
- -----------------------------------------------------------------------
+ ---------------------------- ------ ------ ------ ------ ------ ------ ------
+ File stmt bran cond sub pod time total
+ ---------------------------- ------ ------ ------ ------ ------ ------ ------
+ blib/lib/Excel/Template.pm 93.8 60.0 58.8 100.0 100.0 31.8 83.3
+ ...ib/Excel/Template/Base.pm 94.4 50.0 n/a 100.0 0.0 4.4 80.0
+ ...cel/Template/Container.pm 100.0 50.0 33.3 100.0 0.0 2.0 83.3
+ ...emplate/Container/Bold.pm 100.0 n/a n/a 100.0 0.0 0.1 95.0
+ .../Container/Conditional.pm 95.9 90.0 66.7 100.0 0.0 0.3 91.0
+ ...plate/Container/Format.pm 100.0 n/a n/a 100.0 0.0 1.5 96.8
+ ...plate/Container/Hidden.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0
+ ...plate/Container/Italic.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0
+ ...ainer/KeepLeadingZeros.pm 100.0 100.0 n/a 100.0 0.0 0.0 96.3
+ ...plate/Container/Locked.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0
+ ...emplate/Container/Loop.pm 96.8 50.0 50.0 100.0 0.0 0.1 82.7
+ ...late/Container/Outline.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0
+ ...Template/Container/Row.pm 100.0 75.0 n/a 100.0 0.0 0.1 90.6
+ ...mplate/Container/Scope.pm 100.0 n/a n/a 100.0 n/a 0.0 100.0
+ ...plate/Container/Shadow.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0
+ ...te/Container/Strikeout.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0
+ ...ate/Container/Workbook.pm 100.0 n/a n/a 100.0 n/a 7.0 100.0
+ ...te/Container/Worksheet.pm 95.5 87.5 100.0 100.0 0.0 1.1 90.2
+ ...Excel/Template/Context.pm 98.0 80.0 75.0 100.0 73.3 17.0 90.7
+ ...Excel/Template/Element.pm 100.0 n/a n/a 100.0 n/a 0.1 100.0
+ ...mplate/Element/Backref.pm 100.0 50.0 33.3 100.0 0.0 0.1 87.1
+ .../Template/Element/Cell.pm 97.9 75.0 80.0 100.0 0.0 5.6 88.6
+ ...mplate/Element/Formula.pm 100.0 n/a n/a 100.0 0.0 0.0 94.1
+ ...te/Element/FreezePanes.pm 100.0 n/a n/a 100.0 0.0 0.0 95.5
+ ...Template/Element/Image.pm 100.0 100.0 n/a 100.0 0.0 0.0 94.3
+ ...Template/Element/Range.pm 100.0 66.7 n/a 100.0 0.0 0.1 88.9
+ ...l/Template/Element/Var.pm 100.0 n/a n/a 100.0 0.0 0.0 94.1
+ ...Excel/Template/Factory.pm 100.0 73.1 66.7 100.0 100.0 22.3 91.4
+ .../Excel/Template/Format.pm 98.4 75.0 33.3 100.0 66.7 2.6 90.5
+ ...xcel/Template/Iterator.pm 98.6 80.0 70.6 100.0 50.0 0.3 88.8
+ ...el/Template/TextObject.pm 92.9 62.5 33.3 100.0 0.0 3.3 80.9
+ Total 97.8 74.7 64.6 100.0 35.7 100.0 89.4
+ ---------------------------- ------ ------ ------ ------ ------ ------ ------
=head1 COPYRIGHT