Catalyst-View-Excel-Template-Plus-0.04000755000765000024 012455303132 17443 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/Build.PL000444000765000024 137112455303132 21076 0ustar00stevanstaff000000000000use Module::Build; use strict; my $build = Module::Build->new( module_name => 'Catalyst::View::Excel::Template::Plus', license => 'perl', requires => { 'Catalyst::Runtime' => '0', 'Excel::Template::Plus' => '0.05', }, optional => { }, build_requires => { 'Test::More' => '0.62', 'Test::Exception' => '0.21', 'parent' => '0', }, create_makefile_pl => 'traditional', recursive_test_files => 1, add_to_cleanup => [ 'META.yml', '*.bak', '*.gz', 'Makefile.PL', ], meta_merge => { resources => { repository => 'http://github.com/stevan/catalyst-view-excel-template-plus/' } }, ); $build->create_build_script; Catalyst-View-Excel-Template-Plus-0.04/Changes000444000765000024 133712455303132 21077 0ustar00stevanstaff000000000000Changes for Catalyst::View::Excel::Template::Plus # Date format "%A, %B %d, %Y" 0.04 Tues. Jan. 13, 2015 - Add support for Content-Disposition via stash options - thanks to Alex Balhatchet for this work 0.03 Sunday, April 25, 2010 - Simple release from the developement release 0.02_2 0.02_2 Tuesday, April 20, 2010 - Last development release was shipped with an old Makefile.PL 0.02_1 Monday, April 19, 2010 - add missing build requirement 'parent' 0.02 Thursday, April 15, 2010 - fixed rt#53781 / NEXT deprecated - fixed rt#42166 / Auto determining template filename broken - Add helper class, Catalyst::Helper::View::Excel::Template::Plus 0.01 Monday, July 9, 2007 - initial releaseCatalyst-View-Excel-Template-Plus-0.04/Makefile.PL000444000765000024 134212455303132 21552 0ustar00stevanstaff000000000000# Note: this file was auto-generated by Module::Build::Compat version 0.4003 use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'Catalyst::View::Excel::Template::Plus', 'VERSION_FROM' => 'lib/Catalyst/View/Excel/Template/Plus.pm', 'PREREQ_PM' => { 'Catalyst::Runtime' => '0', 'Excel::Template::Plus' => '0.05', 'Test::Exception' => '0.21', 'Test::More' => '0.62', 'parent' => 0 }, 'INSTALLDIRS' => 'site', 'EXE_FILES' => [], 'PL_FILES' => {}, 'test' => { 'TESTS' => 't/*.t t/lib/*.t t/lib/TestApp/*.t t/lib/TestApp/Controller/*.t t/lib/TestApp/View/*.t t/templates/*.t t/xls/*.t' } ) ; Catalyst-View-Excel-Template-Plus-0.04/MANIFEST000444000765000024 65012455303132 20712 0ustar00stevanstaff000000000000Build.PL Changes lib/Catalyst/Helper/View/Excel/Template/Plus.pm lib/Catalyst/View/Excel/Template/Plus.pm Makefile.PL MANIFEST This list of files META.json META.yml MYMETA.json README t/000_load.t t/001_basic.t t/002_content_disposition.t t/lib/TestApp.pm t/lib/TestApp/Controller/Root.pm t/lib/TestApp/View/Excel.pm t/pod.t t/pod_coverage.t t/templates/test_one.xml.tmpl t/templates/test_two.xml.tmpl t/xls/001_basic.xls Catalyst-View-Excel-Template-Plus-0.04/META.json000444000765000024 265612455303132 21232 0ustar00stevanstaff000000000000{ "abstract" : "A Catalyst View for Excel::Template::Plus", "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" : "Catalyst-View-Excel-Template-Plus", "prereqs" : { "build" : { "requires" : { "Test::Exception" : "0.21", "Test::More" : "0.62", "parent" : "0" } }, "configure" : { "requires" : { "Module::Build" : "0.40" } }, "runtime" : { "requires" : { "Catalyst::Runtime" : "0", "Excel::Template::Plus" : "0.05" } } }, "provides" : { "Catalyst::Helper::View::Excel::Template::Plus" : { "file" : "lib/Catalyst/Helper/View/Excel/Template/Plus.pm" }, "Catalyst::View::Excel::Template::Plus" : { "file" : "lib/Catalyst/View/Excel/Template/Plus.pm", "version" : "0.04" } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "http://github.com/stevan/catalyst-view-excel-template-plus/" } }, "version" : "0.04" } Catalyst-View-Excel-Template-Plus-0.04/META.yml000444000765000024 162712455303132 21057 0ustar00stevanstaff000000000000--- abstract: 'A Catalyst View for Excel::Template::Plus' author: - 'Stevan Little Estevan@cpan.orgE' build_requires: Test::Exception: '0.21' Test::More: '0.62' parent: '0' 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: Catalyst-View-Excel-Template-Plus provides: Catalyst::Helper::View::Excel::Template::Plus: file: lib/Catalyst/Helper/View/Excel/Template/Plus.pm Catalyst::View::Excel::Template::Plus: file: lib/Catalyst/View/Excel/Template/Plus.pm version: '0.04' requires: Catalyst::Runtime: '0' Excel::Template::Plus: '0.05' resources: license: http://dev.perl.org/licenses/ repository: http://github.com/stevan/catalyst-view-excel-template-plus/ version: '0.04' Catalyst-View-Excel-Template-Plus-0.04/README000444000765000024 112112455303132 20453 0ustar00stevanstaff000000000000Catalyst::View::Excel::Template::Plus version 0.04 =========================== 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: Catalyst::Runtime Excel::Template::Plus COPYRIGHT AND LICENCE Copyright (C) 2007-2015 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. Catalyst-View-Excel-Template-Plus-0.04/lib000755000765000024 012455303132 20211 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/lib/Catalyst000755000765000024 012455303132 21775 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/lib/Catalyst/Helper000755000765000024 012455303132 23214 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/lib/Catalyst/Helper/View000755000765000024 012455303132 24126 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/lib/Catalyst/Helper/View/Excel000755000765000024 012455303132 25166 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/lib/Catalyst/Helper/View/Excel/Template000755000765000024 012455303132 26741 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/lib/Catalyst/Helper/View/Excel/Template/Plus.pm000444000765000024 217712455303132 30366 0ustar00stevanstaff000000000000package Catalyst::Helper::View::Excel::Template::Plus; use strict; use warnings; use Carp qw/ croak /; =head1 NAME Catalyst::Helper::View::Excel::Template::Plus - Helper Class for Catalyst::View::Excel::Template::Plus =head1 SYNOPSIS MyApp_create.pl view Excel Excel::Template::Plus =head1 METHODS =head2 mk_compclass =cut sub mk_compclass { my ( $self, $helper ) = @_; $helper->render_file( 'compclass', $helper->{file} ); } =head1 AUTHOR Robert Bohne Erbo@cpan.orgE =head1 COPYRIGHT AND LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; __DATA__ =begin pod_to_ignore __compclass__ package [% class %]; use strict; use warnings; use base qw/Catalyst::View::Excel::Template::Plus/; =head1 NAME [% class %] - Excel::Plus View for [% app %] =head1 SEE ALSO See L<[% app %]>. =head1 DESCRIPTION Catalyst Catalyst::View::Excel::Template::Plus View. =head1 AUTHOR [% author %] =head1 LICENSE This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =cut 1;Catalyst-View-Excel-Template-Plus-0.04/lib/Catalyst/View000755000765000024 012455303132 22707 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/lib/Catalyst/View/Excel000755000765000024 012455303132 23747 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/lib/Catalyst/View/Excel/Template000755000765000024 012455303132 25522 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/lib/Catalyst/View/Excel/Template/Plus.pm000444000765000024 747212455303132 27152 0ustar00stevanstaff000000000000package Catalyst::View::Excel::Template::Plus; use strict; use warnings; use MRO::Compat; use Excel::Template::Plus; use Scalar::Util 'blessed'; use Catalyst::Exception; our $VERSION = '0.04'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Catalyst::View'; __PACKAGE__->mk_accessors(qw[ etp_engine etp_config etp_params ]); sub new { my($class, $c, $args) = @_; my $self = $class->next::method($c, $args); my $config = $c->config->{'View::Excel::Template::Plus'}; $args->{etp_engine} ||= $config->{etp_engine} || 'TT'; $args->{etp_config} ||= $config->{etp_config} || {}; $args->{etp_params} ||= $config->{etp_params} || {}; $self->etp_engine($args->{etp_engine}); $self->etp_config($args->{etp_config}); $self->etp_params($args->{etp_params}); if ( defined $self->config->{TEMPLATE_EXTENSION} && $self->config->{TEMPLATE_EXTENSION} !~ /\./ ){ $c->log->warn(qq/Missing . (dot) in TEMPLATE_EXTENSION ( $class ), the attitude has changed with version 0.02./); } return $self; } sub process { my $self = shift; my $c = shift; my @args = @_; my $template = $self->get_template_filename($c); (defined $template) || die 'No template specified for rendering'; my $etp_engine = $c->stash->{etp_engine} || $self->etp_engine; my $etp_config = $c->stash->{etp_config} || $self->etp_config; my $etp_params = $c->stash->{etp_params} || $self->etp_params; my $excel = $self->create_template_object($c => ( engine => $etp_engine, template => $template, config => $etp_config, params => $etp_params, )); $excel->param( $self->get_template_params($c) ); # handle Content-Type $c->response->content_type('application/x-msexcel'); # handle Content-Disposition my $excel_filename = $c->stash->{excel_filename} || 'excel.xls'; $excel_filename .= '.xls' unless ($excel_filename =~ /\.xls$/i); my $excel_disposition = $c->stash->{excel_disposition} || 'inline'; $c->response->headers->header("Content-Disposition" => qq{$excel_disposition; filename="$excel_filename"}); $c->response->body($excel->output); } sub create_template_object { my ($self, $c, %options) = @_; Excel::Template::Plus->new( %options ); } sub get_template_filename { my ($self, $c) = @_; $c->stash->{template} || ($c->action . '.xml' . $self->config->{TEMPLATE_EXTENSION}); } sub get_template_params { my ($self, $c) = @_; my $cvar = $self->config->{CATALYST_VAR} || 'c'; return ( $cvar => $c, %{ $c->stash } ); } 1; __END__ =pod =head1 NAME Catalyst::View::Excel::Template::Plus - A Catalyst View for Excel::Template::Plus =head1 SYNOPSIS # use the helper to create your View MyApp_create.pl view Excel Excel::Template::Plus =head1 DESCRIPTION This is a Catalyst View subclass which can handle rendering excel content through Excel::Template::Plus. =head1 CONFIG OPTIONS =over 4 =item I =item I =item I =back =head1 STASH OPTIONS =over 4 =item I =item I =back =head1 METHODS =over 4 =item B This really just handles consuming the configuration parameters. =item B =item B =item B =item B =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 AUTHOR Stevan Little Estevan@cpan.orgE =head1 CONTRIBUTORS Robert Bohne Erbo@cpan.orgE =head1 COPYRIGHT AND LICENSE Copyright 2007-2015 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 Catalyst-View-Excel-Template-Plus-0.04/t000755000765000024 012455303132 17706 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/t/000_load.t000444000765000024 20512455303132 21503 0ustar00stevanstaff000000000000#!/usr/bin/perl use strict; use warnings; use Test::More 'no_plan'; BEGIN { use_ok('Catalyst::View::Excel::Template::Plus'); }Catalyst-View-Excel-Template-Plus-0.04/t/001_basic.t000444000765000024 200612455303132 21667 0ustar00stevanstaff000000000000#!/usr/bin/perl use strict; use warnings; use FindBin; use File::Spec; use lib (File::Spec->catdir($FindBin::Bin, 'lib')); use Test::More tests => 6; use Catalyst::Test 'TestApp'; use Test::Excel::Template::Plus qw(cmp_excel_files); BEGIN { use_ok('Catalyst::View::Excel::Template::Plus'); } { my $response = request('http://localhost/test_one'); ok(defined $response, '... got the response successfully'); ok($response->is_success, '... response is a success'); is($response->code, 200, '... response code is 200'); is_deeply( [ $response->content_type ], [ 'application/x-msexcel' ], '... the response content type is application/x-msexcel'); my $excel = $response->content; open my $fh_foo, '>', 'temp.xls' || die "Could not write temp file for testing : $!"; print $fh_foo $excel; close $fh_foo; cmp_excel_files("temp.xls", "t/xls/001_basic.xls", '... the generated excel file was correct'); #`open temp.xls`; unlink 'temp.xls'; }Catalyst-View-Excel-Template-Plus-0.04/t/002_content_disposition.t000444000765000024 133412455303132 24710 0ustar00stevanstaff000000000000#!/usr/bin/perl use strict; use warnings; use FindBin; use File::Spec; use lib (File::Spec->catdir($FindBin::Bin, 'lib')); use Test::More tests => 5; use Catalyst::Test 'TestApp'; use Test::Excel::Template::Plus qw(cmp_excel_files); BEGIN { use_ok('Catalyst::View::Excel::Template::Plus'); } { my $response = request('http://localhost/test_two'); ok(defined $response, '... got the response successfully'); ok($response->is_success, '... response is a success'); is($response->code, 200, '... response code is 200'); is_deeply( [ $response->header('Content-Disposition') ], [ 'attachment; filename="test.xls"' ], '... the response content disposition is correct and sets the filename'); } Catalyst-View-Excel-Template-Plus-0.04/t/pod.t000444000765000024 25712455303132 20776 0ustar00stevanstaff000000000000#!/usr/bin/perl use strict; use warnings; use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); Catalyst-View-Excel-Template-Plus-0.04/t/pod_coverage.t000444000765000024 31712455303132 22646 0ustar00stevanstaff000000000000#!/usr/bin/perl use strict; use warnings; use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); Catalyst-View-Excel-Template-Plus-0.04/t/lib000755000765000024 012455303132 20454 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/t/lib/TestApp.pm000444000765000024 64612455303132 22515 0ustar00stevanstaff000000000000package TestApp; use strict; use warnings; use FindBin; use Catalyst; use Excel::Template::Plus; use Path::Class; use TestApp::View::Excel; __PACKAGE__->config({ name => 'TestApp', 'View::Excel::Template::Plus' => { etp_config => { INCLUDE_PATH => [ (dir($FindBin::Bin, 'templates' )->stringify . '/'), ] } } }); __PACKAGE__->setup; 1; __END__ Catalyst-View-Excel-Template-Plus-0.04/t/lib/TestApp000755000765000024 012455303132 22034 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/t/lib/TestApp/Controller000755000765000024 012455303132 24157 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/t/lib/TestApp/Controller/Root.pm000444000765000024 111012455303132 25566 0ustar00stevanstaff000000000000package TestApp::Controller::Root; use strict; use warnings; use parent 'Catalyst::Controller'; sub test_one : Global { my ($self, $c) = @_; $c->stash->{template} = 'test_one.xml.tmpl'; $c->stash->{message} = 'Hello (Excel) World'; $c->forward('TestApp::View::Excel'); } sub test_two : Global { my ($self, $c) = @_; $c->stash->{template} = 'test_two.xml.tmpl'; $c->stash->{message} = 'Hello (Excel) World'; $c->stash->{excel_filename} = 'test'; $c->stash->{excel_disposition} = 'attachment'; $c->forward('TestApp::View::Excel'); } 1; Catalyst-View-Excel-Template-Plus-0.04/t/lib/TestApp/View000755000765000024 012455303132 22746 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/t/lib/TestApp/View/Excel.pm000444000765000024 17112455303132 24460 0ustar00stevanstaff000000000000package TestApp::View::Excel; use strict; use warnings; use base 'Catalyst::View::Excel::Template::Plus'; 1; __END__ Catalyst-View-Excel-Template-Plus-0.04/t/templates000755000765000024 012455303132 21704 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/t/templates/test_one.xml.tmpl000444000765000024 17312455303132 25337 0ustar00stevanstaff000000000000 [% message %] Catalyst-View-Excel-Template-Plus-0.04/t/templates/test_two.xml.tmpl000444000765000024 17312455303132 25367 0ustar00stevanstaff000000000000 [% message %] Catalyst-View-Excel-Template-Plus-0.04/t/xls000755000765000024 012455303132 20514 5ustar00stevanstaff000000000000Catalyst-View-Excel-Template-Plus-0.04/t/xls/001_basic.xls000444000765000024 1300012455303132 23054 0ustar00stevanstaff000000000000ࡱ>   AB=\508X"1Arial1Arial1Arial1Arial1Tahoma1 Arial                + ) , *     83ffff̙̙3f3fff3f3f33333f33333\Sheet11Hello (Excel) World  A*+%&?'?(?)?"dXX??U >@ Root EntryWorkbook