2010-04-19 11:35:15 +02:00
|
|
|
#
|
2011-11-18 12:44:27 +01:00
|
|
|
# spec file for package perl-Data-OptList
|
2010-04-19 11:35:15 +02:00
|
|
|
#
|
2013-07-16 14:17:23 +02:00
|
|
|
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
2010-04-19 11:35:15 +02:00
|
|
|
#
|
|
|
|
# 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-Data-OptList
|
2013-12-18 11:44:00 +01:00
|
|
|
Version: 0.109
|
2012-02-29 17:09:40 +01:00
|
|
|
Release: 0
|
2013-07-16 14:17:23 +02:00
|
|
|
%define cpan_name Data-OptList
|
|
|
|
Summary: parse and validate simple name/value option pairs
|
|
|
|
License: Artistic-1.0 or GPL-1.0+
|
|
|
|
Group: Development/Libraries/Perl
|
|
|
|
Url: http://search.cpan.org/dist/Data-OptList/
|
|
|
|
Source: http://www.cpan.org/authors/id/R/RJ/RJBS/%{cpan_name}-%{version}.tar.gz
|
2010-04-19 11:35:15 +02:00
|
|
|
BuildArch: noarch
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
BuildRequires: perl
|
|
|
|
BuildRequires: perl-macros
|
2013-07-16 14:17:23 +02:00
|
|
|
BuildRequires: perl(Params::Util)
|
2012-02-29 17:09:40 +01:00
|
|
|
BuildRequires: perl(Sub::Install) >= 0.921
|
2013-07-16 14:17:23 +02:00
|
|
|
BuildRequires: perl(Test::More) >= 0.96
|
2013-12-18 11:44:00 +01:00
|
|
|
|
2013-07-16 14:17:23 +02:00
|
|
|
Requires: perl(Params::Util)
|
2012-02-29 17:09:40 +01:00
|
|
|
Requires: perl(Sub::Install) >= 0.921
|
2013-07-16 14:17:23 +02:00
|
|
|
%{perl_requires}
|
2010-04-19 11:35:15 +02:00
|
|
|
|
|
|
|
%description
|
2012-03-16 10:27:03 +01:00
|
|
|
Hashes are great for storing named data, but if you want more than one
|
|
|
|
entry for a name, you have to use a list of pairs. Even then, this is
|
|
|
|
really boring to write:
|
2010-04-19 11:35:15 +02:00
|
|
|
|
2012-03-16 10:27:03 +01:00
|
|
|
$values = [
|
|
|
|
foo => undef,
|
|
|
|
bar => undef,
|
|
|
|
baz => undef,
|
|
|
|
xyz => { ... },
|
|
|
|
];
|
2010-04-19 11:35:15 +02:00
|
|
|
|
2012-03-16 10:27:03 +01:00
|
|
|
Just look at all those undefs! Don't worry, we can get rid of those:
|
2010-04-19 11:35:15 +02:00
|
|
|
|
2012-03-16 10:27:03 +01:00
|
|
|
$values = [
|
|
|
|
map { $_ => undef } qw(foo bar baz),
|
|
|
|
xyz => { ... },
|
|
|
|
];
|
2010-04-19 11:35:15 +02:00
|
|
|
|
2012-03-16 10:27:03 +01:00
|
|
|
Aaaauuugh! We've saved a little typing, but now it requires thought to
|
2013-07-16 14:17:23 +02:00
|
|
|
read, and thinking is even worse than typing... and it's got a bug! It
|
|
|
|
looked right, didn't it? Well, the 'xyz => { ... }' gets consumed by the
|
|
|
|
map, and we don't get the data we wanted.
|
2010-04-19 11:35:15 +02:00
|
|
|
|
2012-03-16 10:27:03 +01:00
|
|
|
With Data::OptList, you can do this instead:
|
2010-04-19 11:35:15 +02:00
|
|
|
|
2012-03-16 10:27:03 +01:00
|
|
|
$values = Data::OptList::mkopt([
|
|
|
|
qw(foo bar baz),
|
|
|
|
xyz => { ... },
|
|
|
|
]);
|
2010-04-19 11:35:15 +02:00
|
|
|
|
2013-07-16 14:17:23 +02:00
|
|
|
This works by assuming that any defined scalar is a name and any reference
|
|
|
|
following a name is its value.
|
2010-04-19 11:35:15 +02:00
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n %{cpan_name}-%{version}
|
2013-07-16 14:17:23 +02:00
|
|
|
# MANUAL
|
2012-02-29 17:09:40 +01:00
|
|
|
%if 0%{?suse_version} < 1120
|
2012-03-16 10:27:03 +01:00
|
|
|
for i in `find t -type f` ; do
|
|
|
|
sed -i -e "s@^\s*use\s\s*Test::More@use lib '%{perl_vendorlib}';\nuse Test::More@" $i
|
|
|
|
done
|
2012-02-29 17:09:40 +01:00
|
|
|
%endif
|
2010-04-19 11:35:15 +02:00
|
|
|
|
|
|
|
%build
|
2013-07-16 14:17:23 +02:00
|
|
|
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
2010-04-19 11:35:15 +02:00
|
|
|
%{__make} %{?_smp_mflags}
|
|
|
|
|
|
|
|
%check
|
|
|
|
%{__make} test
|
|
|
|
|
|
|
|
%install
|
|
|
|
%perl_make_install
|
2013-07-16 14:17:23 +02:00
|
|
|
%perl_process_packlist
|
2010-04-19 11:35:15 +02:00
|
|
|
%perl_gen_filelist
|
|
|
|
|
|
|
|
%files -f %{name}.files
|
2013-07-16 14:17:23 +02:00
|
|
|
%defattr(-,root,root,755)
|
2010-04-19 11:35:15 +02:00
|
|
|
%doc Changes LICENSE README
|
|
|
|
|
|
|
|
%changelog
|