# # spec file for package perl-MooX-ConfigFromFile # # 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 MooX-ConfigFromFile Name: perl-MooX-ConfigFromFile Version: 0.9.0 Release: 0 # 0.009 -> normalize -> 0.9.0 %define cpan_version 0.009 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Moo eXtension for initializing objects from config file URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/R/RE/REHSACK/%{cpan_name}-%{cpan_version}.tar.gz Source1: cpanspec.yml Source100: README.md BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Config::Any) BuildRequires: perl(File::Find::Rule) >= 0.30 BuildRequires: perl(Hash::Merge) BuildRequires: perl(JSON) BuildRequires: perl(Moo) >= 1.003 BuildRequires: perl(MooX::File::ConfigDir) >= 0.2.0 BuildRequires: perl(Test::More) >= 0.9 Requires: perl(Config::Any) Requires: perl(File::Find::Rule) >= 0.30 Requires: perl(Moo) >= 1.003 Requires: perl(MooX::File::ConfigDir) >= 0.2.0 Provides: perl(MooX::ConfigFromFile) = %{version} Provides: perl(MooX::ConfigFromFile::Role) = %{version} Provides: perl(MooX::ConfigFromFile::Role::HashMergeLoaded) = %{version} Provides: perl(MooX::ConfigFromFile::Role::SortedByFilename) = %{version} %undefine __perllib_provides %{perl_requires} %description This module is intended to easy load initialization values for attributes on object construction from an appropriate config file. The building is done in MooX::ConfigFromFile::Role - using MooX::ConfigFromFile ensures the role is applied. For easier usage, with 0.004, several options can be passed via _use_ resulting in default initializers for appropriate role attributes: * 'config_prefix' Default for MooX::ConfigFromFile::Role/config_prefix. * 'config_prefixes' Default for MooX::ConfigFromFile::Role/config_prefixes. Ensure when use this flag together with MooX::Cmd to load 'MooX::ConfigFromFile' before 'MooX::Cmd'. * 'config_prefix_map_separator' Default for MooX::ConfigFromFile::Role/config_prefix_map_separator. package Foo; # apply role MooX::ConfigFromFile::Role and override default for # attribute config_prefix_map_separator use MooX::ConfigFromFile config_prefix_map_separator => "~"; ... * 'config_extensions' Default for MooX::ConfigFromFile::Role/config_extensions. * 'config_dirs' Default for MooX::ConfigFromFile::Role/config_dirs. Same warning regarding modifying this attribute applies here: Possible, but use with caution! package Foo; use MooX::ConfigFromFile config_dirs => [qw(/opt/foo/etc /home/alfred/area/foo/etc)]; ... * 'config_files' Default for MooX::ConfigFromFile::Role/config_files. Reasonable when you want exactly one config file in development mode. For production code it is highly recommended to override the builder. * 'config_singleton' Flag adding a wrapper around the _builder_ of MooX::ConfigFromFile::Role/loaded_config to ensure a config is loaded only once per class. The _per class_ restriction results from applicable modifiers per class (and singletons are per class). * 'config_identifier' Default for MooX::File::ConfigDir/config_identifier. package Foo; # apply role MooX::ConfigFromFile::Role and override default for # attribute config_identifier - means to look e.g. in /etc/foo/ use MooX::ConfigFromFile config_identifier => "foo"; ... * 'config_hashmergeloaded' Consumes role MooX::ConfigFromFile::Role::HashMergeLoaded directly after MooX::ConfigFromFile::Role has been consumed. %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.md %license ARTISTIC-1.0 GPL-1 LICENSE %changelog