Files
perl-Excel-Template-Plus/perl-Excel-Template-Plus.spec
2025-08-12 18:13:55 +02:00

136 lines
4.5 KiB
RPMSpec

#
# spec file for package perl-Excel-Template-Plus
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define cpan_name Excel-Template-Plus
Name: perl-Excel-Template-Plus
Version: 0.60.0
Release: 0
# 0.06 -> normalize -> 0.60.0
%define cpan_version 0.06
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: An extension to the Excel::Template module
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/S/ST/STEVAN/%{cpan_name}-%{cpan_version}.tar.gz
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Excel::Template)
BuildRequires: perl(IO::String)
BuildRequires: perl(Module::Build) >= 0.40
BuildRequires: perl(Module::Runtime)
BuildRequires: perl(Moose) >= 0.18
BuildRequires: perl(MooseX::Param) >= 0.01
BuildRequires: perl(Spreadsheet::ParseExcel)
BuildRequires: perl(Template)
BuildRequires: perl(Test::Deep)
BuildRequires: perl(Test::Exception) >= 0.21
Requires: perl(Excel::Template)
Requires: perl(IO::String)
Requires: perl(Module::Runtime)
Requires: perl(Moose) >= 0.18
Requires: perl(MooseX::Param) >= 0.01
Requires: perl(Spreadsheet::ParseExcel)
Requires: perl(Template)
Requires: perl(Test::Deep)
Provides: perl(Excel::Template::Plus) = %{version}
Provides: perl(Excel::Template::Plus::TT) = %{version}
Provides: perl(Test::Excel::Template::Plus) = %{version}
%undefine __perllib_provides
%{perl_requires}
%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:
<workbook>
<worksheet name="[% worksheet_name %]">
[% my_cols = get_list_of_columns %]
<row>
[% FOR col = my_cols %]
<bold><cell>[% col %]</cell></bold>
[% END %]
</row>
[% FOR my_row = get_list_of_objects %]
<row>
[% FOR col = my_cols %]
<cell>[% my_row.$col %]</cell>
[% END %]
</row>
[% END %]
</worksheet>
</workbook>
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:
* 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 Template::Declare module perhaps.
* 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.
* 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.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%build
perl Build.PL --installdirs=vendor
./Build build --flags=%{?_smp_mflags}
%check
./Build test
%install
./Build install --destdir=%{buildroot} --create_packlist=0
%perl_gen_filelist
%files -f %{name}.files
%doc ChangeLog README
%changelog