# # spec file for package perl-Class-DBI-Pg # # 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 Class-DBI-Pg Name: perl-Class-DBI-Pg Version: 0.80.0 Release: 0 # 0.08 -> normalize -> 0.80.0 %define cpan_version 0.08 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Class::DBI extension for Postgres URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/D/DM/DMAKI/%{cpan_name}-%{cpan_version}.tar.gz Source100: README.md BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Class::DBI) >= 0.89 BuildRequires: perl(DBD::Pg) >= 1.13 Requires: perl(Class::DBI) >= 0.89 Requires: perl(DBD::Pg) >= 1.13 Provides: perl(Class::DBI::Pg) = %{version} %undefine __perllib_provides %{perl_requires} %description Class::DBI::Pg automate the setup of Class::DBI columns and primary key for Postgres. select Postgres system catalog and find out all columns, primary key and SERIAL type column. create table. CREATE TABLE cd ( id SERIAL NOT NULL PRIMARY KEY, title TEXT, artist TEXT, release_date DATE ); setup your class. package CD; use strict; use base qw(Class::DBI::Pg); __PACKAGE__->set_db(Main => 'dbi:Pg:dbname=db', 'user', 'password'); __PACKAGE__->set_up_table('cd'); This is almost the same as the following way. package CD; use strict; use base qw(Class::DBI); __PACKAGE__->set_db(Main => 'dbi:Pg:dbname=db', 'user', 'password'); __PACKAGE__->table('cd'); __PACKAGE__->columns(Primary => 'id'); __PACKAGE__->columns(All => qw(id title artist release_date)); __PACKAGE__->sequence('cd_id_seq'); %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