# # spec file for package perl-Dancer-Plugin-Database # # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # 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 http://bugs.opensuse.org/ # Name: perl-Dancer-Plugin-Database Version: 2.10 Release: 0 %define cpan_name Dancer-Plugin-Database Summary: Easy Database Connections for Dancer Applications License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Dancer-Plugin-Database/ Source0: http://www.cpan.org/authors/id/A/AM/AMBS/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Dancer) >= 1.3099 BuildRequires: perl(Dancer::Plugin::Database::Core) >= 0.08 Requires: perl(Dancer) >= 1.3099 Requires: perl(Dancer::Plugin::Database::Core) >= 0.08 %{perl_requires} %description Provides an easy way to obtain a connected DBI database handle by simply calling the database keyword within your the Dancer manpage application Returns a the Dancer::Plugin::Database::Core::Handle manpage object, which is a subclass of the DBI manpage'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 the Dancer::Plugin::Database::Core::Handle manpage 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 %setup -q -n %{cpan_name}-%{version} %build %{__perl} Makefile.PL INSTALLDIRS=vendor %{__make} %{?_smp_mflags} %check %{__make} test %install %perl_make_install %perl_process_packlist %perl_gen_filelist %files -f %{name}.files %defattr(-,root,root,755) %doc Changes README %changelog