File perl-Data-OptList.spec of Package perl-Data-OptList

#
# spec file for package perl-Data-OptList
#
# Copyright (c) 2012 SUSE LINUX Products 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-Data-OptList
%define         cpan_name Data-OptList
Summary:        Parse and validate simple name/value option pairs
License:        Artistic-1.0
Group:          Development/Libraries/Perl
Version:        0.107
Release:        0
Url:            http://search.cpan.org/dist/Data-OptList
Source:         http://search.cpan.org/CPAN/authors/id/R/RJ/RJBS/Data-OptList-%{version}.tar.gz
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{perl_requires}
BuildRequires:  perl
BuildRequires:  perl-macros
BuildRequires:  perl(List::Util) >= 0.00
BuildRequires:  perl(Test::More) >= 0.88
# other not perl || perl-base
BuildRequires:  perl(Params::Util) >= 0.14
BuildRequires:  perl(Sub::Install) >= 0.921
#
Requires:       perl(List::Util) >= 0.00
# other not perl || perl-base
Requires:       perl(Params::Util) >= 0.14
Requires:       perl(Sub::Install) >= 0.921

%description
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:

  $values = [
    foo => undef,
    bar => undef,
    baz => undef,
    xyz => { ... },
  ];

Just look at all those undefs! Don't worry, we can get rid of those:

  $values = [
    map { $_ => undef } qw(foo bar baz),
    xyz => { ... },
  ];

Aaaauuugh! We've saved a little typing, but now it requires thought to
read, and thinking is even worse than typing.

With Data::OptList, you can do this instead:

  $values = Data::OptList::mkopt([
    qw(foo bar baz),
    xyz => { ... },
  ]);

This works by assuming that any defined scalar is a name and any
reference following a name is its value.

%prep
%setup -q -n %{cpan_name}-%{version}
%if 0%{?suse_version} < 1120
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
%endif

%build
%{__perl} Makefile.PL OPTIMIZE="$RPM_OPT_FLAGS -Wall"
%{__make} %{?_smp_mflags}

%check
%{__make} test

%install
%perl_make_install
# do not perl_process_packlist (noarch)
# remove .packlist file
%{__rm} -rf $RPM_BUILD_ROOT%perl_vendorarch
# remove perllocal.pod file
%{__rm} -rf $RPM_BUILD_ROOT%perl_archlib
%perl_gen_filelist

%clean 
%{__rm} -rf $RPM_BUILD_ROOT

%files -f %{name}.files
%defattr(-,root,root)
%doc Changes LICENSE README

%changelog
openSUSE Build Service is sponsored by