Excel-Template-Plus-0.06000755000765000024 012455302174 14760 5ustar00stevanstaff000000000000Excel-Template-Plus-0.06/Build.PL000444000765000024 174112455302174 16414 0ustar00stevanstaff000000000000use Module::Build; use strict; use warnings; my $build = Module::Build->new( module_name => 'Excel::Template::Plus', license => 'perl', requires => { 'Excel::Template' => '0', 'Template' => '0', 'IO::String' => '0', 'Moose' => '0.18', 'MooseX::Param' => '0.01', 'Module::Runtime' => '0', # for Test::Excel::Template::Plus 'Test::Deep' => '0', 'Spreadsheet::ParseExcel' => '0', }, optional => { }, build_requires => { 'Test::More' => '0.47', 'Test::Exception' => '0.21', 'File::Spec' => '0', 'FindBin' => '0', }, create_makefile_pl => 'traditional', recursive_test_files => 1, add_to_cleanup => [ 'META.yml', '*.bak', '*.gz', 'Makefile.PL', ], ); $build->create_build_script; Excel-Template-Plus-0.06/ChangeLog000444000765000024 247312455302174 16675 0ustar00stevanstaff000000000000Changes for Excel::Template::Plus 0.06 Tues. Jan. 13, 2014 - Replace Class::MOP::load_class with Module::Runtime::use_module - thanks to Alex Balhatchet 0.05 Mon. Feb 22, 2010 - updates copyright on all files * Test::Excel::Template::Plus - Fixing some test failures because of an internals change in Spreadsheet::ParseExcel - thanks to Chris Travers 0.04 Mon. Dec. 31, 2007 * Excel::Template::Plus - added example template to the docs thanks to Peter Karman for this. * Excel::Template::Plus::TT - removed the 'use FindBin' at the top which was doing nothing at all 0.03 Tues, July 3, 2007 * Excel::Template::Plus::TT - added template_class to allow for using subclasses of Template - removed File::Tempfile and File::Slurp dependency in favor of using IO::String instead 0.02 Tues, March 13, 2007 * Excel::Template::Plus - Now uses the Class::MOP::load_class method (bumped up the Moose dependency to make sure all is aligned) * Excel::Template::Plus::TT - removed param method and added the MooseX::Param role instead 0.01 Friday, March 2, 2007 - initial module release - adapted from several in-house add-ons to Excel::Template and Excel::Template::TTExcel-Template-Plus-0.06/Makefile.PL000444000765000024 161712455302174 17074 0ustar00stevanstaff000000000000# Note: this file was auto-generated by Module::Build::Compat version 0.4003 use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'Excel::Template::Plus', 'VERSION_FROM' => 'lib/Excel/Template/Plus.pm', 'PREREQ_PM' => { 'Excel::Template' => '0', 'File::Spec' => 0, 'FindBin' => 0, 'IO::String' => '0', 'Module::Runtime' => '0', 'Moose' => '0.18', 'MooseX::Param' => '0.01', 'Spreadsheet::ParseExcel' => '0', 'Template' => '0', 'Test::Deep' => '0', 'Test::Exception' => '0.21', 'Test::More' => '0.47' }, 'INSTALLDIRS' => 'site', 'EXE_FILES' => [], 'PL_FILES' => {}, 'test' => { 'TESTS' => 't/*.t t/templates/*.t t/xls/*.t' } ) ; Excel-Template-Plus-0.06/MANIFEST000444000765000024 41012455302174 16221 0ustar00stevanstaff000000000000Build.PL ChangeLog Makefile.PL META.yml MANIFEST MANIFEST.SKIP README lib/Excel/Template/Plus.pm lib/Excel/Template/Plus/TT.pm lib/Test/Excel/Template/Plus.pm t/000_load.t t/001_basic.t t/pod.t t/pod_coverage.t t/templates/basic.tmpl t/xls/001_basic.xls META.json Excel-Template-Plus-0.06/MANIFEST.SKIP000444000765000024 24412455302174 16773 0ustar00stevanstaff000000000000^_build ^Build$ ^blib ~$ \.bak$ ^MANIFEST\.SKIP$ CVS \.svn \.DS_Store cover_db \..*\.sw.?$ ^Makefile$ ^pm_to_blib$ ^MakeMaker-\d ^blibdirs$ \.old$ ^#.*#$ ^\.# ^miscExcel-Template-Plus-0.06/META.json000444000765000024 316212455302174 16540 0ustar00stevanstaff000000000000{ "abstract" : "An extension to the Excel::Template module", "author" : [ "Stevan Little Estevan@cpan.orgE" ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.142060", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Excel-Template-Plus", "prereqs" : { "build" : { "requires" : { "File::Spec" : "0", "FindBin" : "0", "Test::Exception" : "0.21", "Test::More" : "0.47" } }, "configure" : { "requires" : { "Module::Build" : "0.40" } }, "runtime" : { "requires" : { "Excel::Template" : "0", "IO::String" : "0", "Module::Runtime" : "0", "Moose" : "0.18", "MooseX::Param" : "0.01", "Spreadsheet::ParseExcel" : "0", "Template" : "0", "Test::Deep" : "0" } } }, "provides" : { "Excel::Template::Plus" : { "file" : "lib/Excel/Template/Plus.pm", "version" : "0.06" }, "Excel::Template::Plus::TT" : { "file" : "lib/Excel/Template/Plus/TT.pm", "version" : "0.06" }, "Test::Excel::Template::Plus" : { "file" : "lib/Test/Excel/Template/Plus.pm", "version" : "0.06" } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ] }, "version" : "0.06" } Excel-Template-Plus-0.06/META.yml000444000765000024 176012455302174 16372 0ustar00stevanstaff000000000000--- abstract: 'An extension to the Excel::Template module' author: - 'Stevan Little Estevan@cpan.orgE' build_requires: File::Spec: '0' FindBin: '0' Test::Exception: '0.21' Test::More: '0.47' configure_requires: Module::Build: '0.40' dynamic_config: 1 generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 2.142060' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Excel-Template-Plus provides: Excel::Template::Plus: file: lib/Excel/Template/Plus.pm version: '0.06' Excel::Template::Plus::TT: file: lib/Excel/Template/Plus/TT.pm version: '0.06' Test::Excel::Template::Plus: file: lib/Test/Excel/Template/Plus.pm version: '0.06' requires: Excel::Template: '0' IO::String: '0' Module::Runtime: '0' Moose: '0.18' MooseX::Param: '0.01' Spreadsheet::ParseExcel: '0' Template: '0' Test::Deep: '0' resources: license: http://dev.perl.org/licenses/ version: '0.06' Excel-Template-Plus-0.06/README000444000765000024 147412455302174 16003 0ustar00stevanstaff000000000000Excel::Template::Plus version 0.06 ===================================== See the individual module documentation for more information INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DEPENDENCIES This module requires these other modules and libraries: Excel::Template Template IO::String Moose MooseX::Param The Test::Excel::Template::Plus module also requires: Test::Deep Spreadsheet::ParseExcel And requires these modules for testing: Test::More Test::Exception FindBin File::Spec::Functions COPYRIGHT AND LICENCE Copyright (C) 2007-2014 Infinity Interactive, Inc. http://www.iinteractive.com This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Excel-Template-Plus-0.06/lib000755000765000024 012455302174 15526 5ustar00stevanstaff000000000000Excel-Template-Plus-0.06/lib/Excel000755000765000024 012455302174 16566 5ustar00stevanstaff000000000000Excel-Template-Plus-0.06/lib/Excel/Template000755000765000024 012455302174 20341 5ustar00stevanstaff000000000000Excel-Template-Plus-0.06/lib/Excel/Template/Plus.pm000444000765000024 1072012455302174 21777 0ustar00stevanstaff000000000000 package Excel::Template::Plus; use Moose; use Module::Runtime (); our $VERSION = '0.06'; our $AUTHORITY = 'cpan:STEVAN'; sub new { shift; my %options = @_; my $engine_class = 'Excel::Template::Plus::' . $options{engine}; eval { Module::Runtime::use_module($engine_class) }; if ($@) { confess "Could not load engine class ($engine_class) because " . $@; } my $template = eval { $engine_class->new(%options) }; if ($@) { confess "Could not create template from engine class ($engine_class) because " . $@; } return $template; } no Moose; 1; __END__ =pod =head1 NAME Excel::Template::Plus - An extension to the Excel::Template module =head1 SYNOPSIS use Excel::Template::Plus; my $template = Excel::Template::Plus->new( engine => 'TT', template => 'greeting.tmpl', config => { INCLUDE => [ '/templates' ] }, params => { greeting => 'Hello' } ); $template->param(location => 'World'); $template->write_file('greeting.xls'); =head1 DISCLAIMER This is the very first release of this module, it is an idea that I and Rob Kinyon (the author of Excel::Template) had discussed many times, but never got around to doing. This is the first attempt at bring this to reality, it may change B as it evolves, so be warned. =head1 DESCRIPTION This module is an extension of the Excel::Template module, which allows the user to use various "engines" from which you can create Excel files through Excel::Template. The idea is to use the existing (and very solid) excel file generation code in Excel::Template, but to extend its more templatey bits with more powerful options. The only engine currently provided is the Template Toolkit engine, which replaces Excel::Template's built in template features (the LOOP, and IF constructs) with the full power of TT. This is similar to the module Excel::Template::TT, but expands on that even further to try and create a more extensive system. You can use this module to create Excel::Template-compatible XML files using one of the supported engines. For example, with the TT engine you could create a Excel::Template XML file like: [% my_cols = get_list_of_columns %] [% FOR col = my_cols %] [% col %] [% END %] [% FOR my_row = get_list_of_objects %] [% FOR col = my_cols %] [% my_row.$col %] [% END %] [% END %] Your TT template thus creates a XML file suitable to handing over to Excel::Template for processing. Excel::Template::Plus simplifies the template-creation and handing-over process. Future engine/plans include: =over 4 =item Pure Perl This would allow you to write you Excel::Template files using Perl itself which would then output the XML for Excel::Template to consume. This would be modeled after the recently released L module perhaps. =item TT Plugins/Macros/Wrappers This is basically anything which will make the TT engine easier to write templates for. I have experimented with some of these things, but I was not happy with any of them enough to release them yet. =item HTML::Template Excel::Template's templating features are based on HTML::Template, but the HTML::Template plugins and other goodies are not compatible. This engine would bring those things to Excel::Template. =back =head1 METHODS =over 4 =item B This method basically serves as a factory for creating new engine instances (for which L is the only one currently). The only parameter that it requires is I, all other parameters are passed onto the engine's constructor (see the individual docs for more details on what is required). =item B Access to the metaclass. =back =head1 BUGS All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT. =head1 ACKNOWLEDGEMENTS =over 4 =item This module came out of several discussions I had with Rob Kinyon. =back =head1 AUTHOR Stevan Little Estevan@cpan.orgE =head1 COPYRIGHT AND LICENSE Copyright 2007-2014 by Infinity Interactive, Inc. L This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut Excel-Template-Plus-0.06/lib/Excel/Template/Plus000755000765000024 012455302174 21264 5ustar00stevanstaff000000000000Excel-Template-Plus-0.06/lib/Excel/Template/Plus/TT.pm000444000765000024 766312455302174 22322 0ustar00stevanstaff000000000000 package Excel::Template::Plus::TT; use Moose; use Moose::Util::TypeConstraints; use Template (); use IO::String (); use Module::Runtime (); use Excel::Template; our $VERSION = '0.06'; our $AUTHORITY = 'cpan:STEVAN'; with 'MooseX::Param'; subtype 'IO::Handle' => as 'Object' => where { $_->isa('IO::Handle') }; has 'template' => ( is => 'ro', # can either be a: # - filename # - scalar ref to string # - open filehandle # - an IO::Handle instance # (basically anything TT takes) isa => 'Str | ScalarRef | FileHandle | IO::Handle', required => 1, ); has 'config' => ( is => 'ro', isa => 'HashRef', default => sub {{}}, ); has '_template_object' => ( is => "rw", isa => "Template", lazy => 1, default => sub { my $self = shift; my $class = $self->template_class; Module::Runtime::use_module($class); ($class->isa('Template')) || confess "The template_class must be Template or a subclass of it"; $class->new( $self->config ) } ); has 'template_class' => ( is => "rw", isa => "Str", default => "Template", ); ## private attributes has '_excel_template' => ( is => 'ro', isa => 'Excel::Template', handles => [qw[ output write_file ]], lazy => 1, default => sub { my $self = shift; $self->_prepare_excel_template; } ); sub _prepare_excel_template { my $self = shift; my $buf; my $fh = IO::String->new(\$buf); my $tt = $self->_template_object; $tt->process( $self->template, $self->params, $fh, ); $fh->pos(0); confess "Template creation failed because : " . $tt->error() if $tt->error(); confess "Template failed to produce any output" unless length($buf); my $excel_template = eval { Excel::Template->new(file => $fh) }; if ($@) { warn $buf; confess $@; } return $excel_template; } no Moose; no Moose::Util::TypeConstraints; 1; __END__ =pod =head1 NAME Excel::Template::Plus::TT - Extension of Excel::Template to use TT =head1 SYNOPSIS use Excel::Template::Plus::TT; # this is most commonly used through # the Excel::Template::Plus factory my $template = Excel::Template::Plus::TT->new( template => 'greeting.tmpl', config => { INCLUDE => [ '/templates' ] }, params => { greeting => 'Hello' } ); $template->param(location => 'World'); $template->write_file('greeting.xls'); =head1 DESCRIPTION This is an engine for Excel::Template::Plus which replaces the standard Excel::Template template features with TT. See the L docs for more information. =head1 METHODS =head2 Accessors =over 4 =item B =item B