Files
perl-Dancer-Plugin-Database/perl-Dancer-Plugin-Database.spec
2025-08-12 18:12:58 +02:00

85 lines
3.0 KiB
RPMSpec

#
# spec file for package perl-Dancer-Plugin-Database
#
# 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 Dancer-Plugin-Database
Name: perl-Dancer-Plugin-Database
Version: 2.130.0
Release: 0
# 2.13 -> normalize -> 2.130.0
%define cpan_version 2.13
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Easy database connections for Dancer applications
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/B/BI/BIGPRESH/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Dancer) >= 1.309.900
BuildRequires: perl(Dancer::Plugin::Database::Core) >= 0.160
Requires: perl(Dancer) >= 1.309.900
Requires: perl(Dancer::Plugin::Database::Core) >= 0.160
Provides: perl(Dancer::Plugin::Database) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
Provides an easy way to obtain a connected DBI database handle by simply
calling the database keyword within your Dancer application
Returns a Dancer::Plugin::Database::Core::Handle object, which is a
subclass of DBI's 'DBI::db' connection handle object, so it does everything
you'd expect to do with DBI, but also adds a few convenience methods. See
the documentation for Dancer::Plugin::Database::Core::Handle for full
details of those.
Takes care of ensuring that the database handle is still connected and
valid. If the handle was last asked for more than
'connection_check_threshold' seconds ago, it will check that the connection
is still alive, using either the '$dbh->ping' method if the DBD driver
supports it, or performing a simple no-op query against the database if
not. If the connection has gone away, a new connection will be obtained and
returned. This avoids any problems for a long-running script where the
connection to the database might go away.
Care is taken that handles are not shared across processes/threads, so this
should be thread-safe with no issues with transactions etc. (Thanks to Matt
S Trout for pointing out the previous lack of thread safety. Inspiration
was drawn from DBIx::Connector.)
%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
%changelog