automatic update OBS-URL: https://build.opensuse.org/request/show/341309 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-enum?expand=0&rev=3
82 lines
2.5 KiB
RPMSpec
82 lines
2.5 KiB
RPMSpec
#
|
|
# spec file for package perl-enum
|
|
#
|
|
# Copyright (c) 2015 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-enum
|
|
Version: 1.11
|
|
Release: 0
|
|
%define cpan_name enum
|
|
Summary: C style enumerated types and bitmask flags in Perl
|
|
License: Artistic-1.0 or GPL-1.0+
|
|
Group: Development/Libraries/Perl
|
|
Url: http://search.cpan.org/dist/enum/
|
|
Source0: http://www.cpan.org/authors/id/N/NE/NEILB/%{cpan_name}-%{version}.tar.gz
|
|
Source1: cpanspec.yml
|
|
BuildArch: noarch
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
BuildRequires: perl
|
|
BuildRequires: perl-macros
|
|
%{perl_requires}
|
|
|
|
%description
|
|
This module is used to define a set of constants with ordered numeric
|
|
values, similar to the 'enum' type in the C programming language. You can
|
|
also define bitmask constants, where the value assigned to each constant
|
|
has exactly one bit set (eg 1, 2, 4, 8, etc).
|
|
|
|
What are enumerations good for? Typical uses would be for giving mnemonic
|
|
names to indexes of arrays. Such arrays might be a list of months, days, or
|
|
a return value index from a function such as localtime():
|
|
|
|
use enum qw(
|
|
:Months_=0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
|
|
:Days_=0 Sun Mon Tue Wed Thu Fri Sat
|
|
:LC_=0 Sec Min Hour MDay Mon Year WDay YDay Isdst
|
|
);
|
|
|
|
if ((localtime)[LC_Mon] == Months_Jan) {
|
|
print "It's January!\n";
|
|
}
|
|
if ((localtime)[LC_WDay] == Days_Fri) {
|
|
print "It's Friday!\n";
|
|
}
|
|
|
|
This not only reads easier, but can also be typo-checked at compile time
|
|
when run under *use strict*. That is, if you misspell *Days_Fri* as
|
|
*Days_Fry*, you'll generate a compile error.
|
|
|
|
%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
|
|
|
|
%changelog
|