File perl-AppConfig.spec of Package perl-AppConfig
#
# spec file for package perl-AppConfig
#
# Copyright (c) 2017 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-AppConfig
Version: 1.71
Release: 0
%define cpan_name AppConfig
Summary: Perl5 module for reading configuration files and parsing command line arguments
License: Artistic-1.0 or GPL-1.0+
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/AppConfig/
Source0: https://cpan.metacpan.org/authors/id/N/NE/NEILB/%{cpan_name}-%{version}.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Test::Pod) >= 1.0
%{perl_requires}
%description
AppConfig is a Perl5 module for managing application configuration
information. It maintains the state of any number of variables and provides
methods for parsing configuration files, command line arguments and CGI
script parameters.
Variables values may be set via configuration files. Variables may be flags
(On/Off), take a single value, or take multiple values stored as a list or
hash. The number of arguments a variable expects is determined by its
configuration when defined.
# flags
verbose
nohelp
debug = On
# single value
home = /home/abw/
# multiple list value
file = /tmp/file1
file = /tmp/file2
# multiple hash value
book camel = Programming Perl
book llama = Learning Perl
The '-' prefix can be used to reset a variable to its default value and the
'+' prefix can be used to set it to 1
-verbose
+debug
Variable, environment variable and tilde (home directory) expansions can be
applied (selectively, if necessary) to the values read from configuration
files:
home = ~ # home directory
nntp = ${NNTPSERVER} # environment variable
html = $home/html # internal variables
img = $html/images
Configuration files may be arranged in blocks as per the style of Win32
"INI" files.
[file]
site = kfs
src = ~/websrc/docs/$site
lib = ~/websrc/lib
dest = ~/public_html/$site
[page]
header = $lib/header
footer = $lib/footer
You can also use Perl's "heredoc" syntax to define a large block of text in
a configuration file.
multiline = <<FOOBAR
line 1
line 2
FOOBAR
paths exe = "${PATH}:${HOME}/.bin"
paths link = <<'FOO'
${LD_LIBARRAY_PATH}:${HOME}/lib
FOO
Variables may also be set by parsing command line arguments.
myapp -verbose -site kfs -file f1 -file f2
AppConfig provides a simple method (args()) for parsing command line
arguments. A second method (getopt()) allows more complex argument
processing by delegation to Johan Vroman's Getopt::Long module.
AppConfig also allows variables to be set by parameters passed to a CGI
script via the URL (GET method).
http://www.nowhere.com/cgi-bin/myapp?verbose&site=kfs
%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 TODO
%license LICENSE
%changelog