134 lines
4.2 KiB
RPMSpec
134 lines
4.2 KiB
RPMSpec
#
|
|
# spec file for package perl-Catalyst-View-TT
|
|
#
|
|
# 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 Catalyst-View-TT
|
|
Name: perl-Catalyst-View-TT
|
|
Version: 0.460.0
|
|
Release: 0
|
|
# 0.46 -> normalize -> 0.460.0
|
|
%define cpan_version 0.46
|
|
License: Artistic-1.0 OR GPL-1.0-or-later
|
|
Summary: Template View Class
|
|
URL: https://metacpan.org/release/%{cpan_name}
|
|
Source0: https://cpan.metacpan.org/authors/id/J/JJ/JJNAPIORK/%{cpan_name}-%{cpan_version}.tar.gz
|
|
Source1: cpanspec.yml
|
|
Source100: README.md
|
|
BuildArch: noarch
|
|
BuildRequires: perl
|
|
BuildRequires: perl-macros
|
|
BuildRequires: perl(Catalyst) >= 5.700.0
|
|
BuildRequires: perl(Class::Accessor)
|
|
BuildRequires: perl(Data::Dump)
|
|
BuildRequires: perl(List::Util) >= 1.33
|
|
BuildRequires: perl(MRO::Compat)
|
|
BuildRequires: perl(Path::Class)
|
|
BuildRequires: perl(Template)
|
|
BuildRequires: perl(Template::Timer)
|
|
BuildRequires: perl(Test::More) >= 0.88
|
|
Requires: perl(Catalyst) >= 5.700.0
|
|
Requires: perl(Class::Accessor)
|
|
Requires: perl(Data::Dump)
|
|
Requires: perl(MRO::Compat)
|
|
Requires: perl(Path::Class)
|
|
Requires: perl(Template)
|
|
Requires: perl(Template::Timer)
|
|
Provides: perl(Catalyst::Helper::View::TT) = %{version}
|
|
Provides: perl(Catalyst::Helper::View::TTSite) = %{version}
|
|
Provides: perl(Catalyst::View::TT) = %{version}
|
|
%undefine __perllib_provides
|
|
%{perl_requires}
|
|
|
|
%description
|
|
This is the Catalyst view class for the Template Toolkit. Your application
|
|
should defined a view class which is a subclass of this module. Throughout
|
|
this manual it will be assumed that your application is named _MyApp_ and
|
|
you are creating a TT view named _Web_; these names are placeholders and
|
|
should always be replaced with whatever name you've chosen for your
|
|
application and your view. The easiest way to create a TT view class is
|
|
through the _myapp_create.pl_ script that is created along with the
|
|
application:
|
|
|
|
$ script/myapp_create.pl view Web TT
|
|
|
|
This creates a _MyApp::View::Web.pm_ module in the _lib_ directory (again,
|
|
replacing 'MyApp' with the name of your application) which looks something
|
|
like this:
|
|
|
|
package FooBar::View::Web;
|
|
use Moose;
|
|
|
|
extends 'Catalyst::View::TT';
|
|
|
|
__PACKAGE__->config(DEBUG => 'all');
|
|
|
|
Now you can modify your action handlers in the main application and/or
|
|
controllers to forward to your view class. You might choose to do this in
|
|
the end() method, for example, to automatically forward all actions to the
|
|
TT view class.
|
|
|
|
# In MyApp or MyApp::Controller::SomeController
|
|
|
|
sub end : Private {
|
|
my( $self, $c ) = @_;
|
|
$c->forward( $c->view('Web') );
|
|
}
|
|
|
|
But if you are using the standard auto-generated end action, you don't even
|
|
need to do this!
|
|
|
|
# in MyApp::Controller::Root
|
|
sub end : ActionClass('RenderView') {} # no need to change this line
|
|
|
|
# in MyApp.pm
|
|
__PACKAGE__->config(
|
|
...
|
|
default_view => 'Web',
|
|
);
|
|
|
|
This will Just Work. And it has the advantages that:
|
|
|
|
* If you want to use a different view for a given request, just set <<
|
|
$c->stash->{current_view}>>. (See Catalyst's '$c->view' method for details.
|
|
|
|
* << $c->res->redirect>> is handled by default. If you just forward to
|
|
'View::Web' in your 'end' routine, you could break this by sending
|
|
additional content.
|
|
|
|
See Catalyst::Action::RenderView for more details.
|
|
|
|
%prep
|
|
%autosetup -n %{cpan_name}-%{cpan_version}
|
|
|
|
%build
|
|
perl Makefile.PL INSTALLDIRS=vendor
|
|
%make_build
|
|
|
|
%check
|
|
make test
|
|
|
|
%install
|
|
%perl_make_install
|
|
%perl_process_packlist
|
|
%perl_gen_filelist
|
|
|
|
%files -f %{name}.files
|
|
%doc Changes README
|
|
%license LICENSE
|
|
|
|
%changelog
|