1 |
# |
2 |
# - Class::ParamParser - |
3 |
# This spec file was automatically generated by cpan2rpm [ver: 2.026] |
4 |
# The following arguments were used: |
5 |
# --version 1.0401 --release 2centos Class::ParamParser |
6 |
# For more information on cpan2rpm please visit: http://perl.arix.com/ |
7 |
# |
8 |
%define pkgname Class-ParamParser |
9 |
%define filelist %{pkgname}-%{version}-filelist |
10 |
%define NVR %{pkgname}-%{version}-%{release} |
11 |
%define maketest 1 |
12 |
|
13 |
name: perl-Class-ParamParser |
14 |
summary: Class-ParamParser - Provides complex parameter list parsing |
15 |
version: 1.0401 |
16 |
release: 2%{?dist} |
17 |
license: Artistic |
18 |
group: Applications/CPAN |
19 |
url: http://www.cpan.org |
20 |
buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n) |
21 |
buildarch: noarch |
22 |
prefix: %(echo %{_prefix}) |
23 |
source: http://search.cpan.org/dist/D/DU/DUNCAND/Class-ParamParser-1.041.tar.gz |
24 |
|
25 |
%description |
26 |
This Perl 5 object class implements two methods which inherited classes can use |
27 |
to tidy up parameter lists for their own methods and functions. The two methods |
28 |
differ in that one returns a HASH ref containing named parameters and the other |
29 |
returns an ARRAY ref containing positional parameters. |
30 |
|
31 |
Both methods can process the same kind of input parameter formats: |
32 |
|
33 |
=over 4 |
34 |
|
35 |
=item |
36 |
|
37 |
I<empty list> |
38 |
|
39 |
=item |
40 |
|
41 |
value |
42 |
|
43 |
=item |
44 |
|
45 |
value1, value2, ... |
46 |
|
47 |
=item |
48 |
|
49 |
name1 => value1, name2 => value2, ... |
50 |
|
51 |
=item |
52 |
|
53 |
-name1 => value1, -NAME2 => value2, ... |
54 |
|
55 |
=item |
56 |
|
57 |
{ -Name1 => value1, NAME2 => value2, ... } |
58 |
|
59 |
=item |
60 |
|
61 |
{ name1 => value1, -Name2 => value2, ... }, valueR |
62 |
|
63 |
=item |
64 |
|
65 |
{ name1 => value1, -Name2 => value2, ... }, valueR1, valueR2, ... |
66 |
|
67 |
=back |
68 |
|
69 |
Those examples included single or multiple positional parameters, single or |
70 |
multiple named parameters, and a HASH ref containing named parameters (with |
71 |
optional "remaining" values afterwards). That list of input variations is not |
72 |
exhaustive. Named parameters can either be prefixed with "-" or left natural. |
73 |
|
74 |
We assume that the parameters are named when either they come as a HASH ref or |
75 |
the first parameter begins with a "-". We assume that they are positional if |
76 |
there is an odd number of them. Otherwise we are in doubt and rely on an |
77 |
optional argument to the tidying method that tells us which to guess by default. |
78 |
|
79 |
We assume that any "value" may be an array ref (aka "multiple" values under the |
80 |
same name) and hence we don't do anything special with them, passing them as is. |
81 |
The only exception to this is with "remaining" values; if there is more than one |
82 |
of them and the first isn't an array ref, then they are all put in an array ref. |
83 |
|
84 |
If the source and destination are both positional, then they are identical. |
85 |
|
86 |
# |
87 |
# This package was generated automatically with the cpan2rpm |
88 |
# utility. To get this software or for more information |
89 |
# please visit: http://perl.arix.com/ |
90 |
# |
91 |
|
92 |
%prep |
93 |
%setup -q -n %{pkgname}-1.041 |
94 |
chmod -R u+w %{_builddir}/%{pkgname}-1.041 |
95 |
|
96 |
%build |
97 |
grep -rsl '^#!.*perl' . | |
98 |
grep -v '.bak$' |xargs --no-run-if-empty \ |
99 |
%__perl -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)' |
100 |
CFLAGS="$RPM_OPT_FLAGS" |
101 |
%{__perl} Makefile.PL `%{__perl} -MExtUtils::MakeMaker -e ' print qq|PREFIX=%{buildroot}%{_prefix}| if \$ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/ '` |
102 |
%{__make} |
103 |
%if %maketest |
104 |
%{__make} test |
105 |
%endif |
106 |
|
107 |
%install |
108 |
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} |
109 |
|
110 |
%{makeinstall} `%{__perl} -MExtUtils::MakeMaker -e ' print \$ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=%{buildroot}%{_prefix}| : qq|DESTDIR=%{buildroot}| '` |
111 |
|
112 |
[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress |
113 |
|
114 |
# SuSE Linux |
115 |
if [ -e /etc/SuSE-release -o -e /etc/UnitedLinux-release ] |
116 |
then |
117 |
%{__mkdir_p} %{buildroot}/var/adm/perl-modules |
118 |
%{__cat} `find %{buildroot} -name "perllocal.pod"` \ |
119 |
| %{__sed} -e s+%{buildroot}++g \ |
120 |
> %{buildroot}/var/adm/perl-modules/%{name} |
121 |
fi |
122 |
|
123 |
# remove special files |
124 |
find %{buildroot} -name "perllocal.pod" \ |
125 |
-o -name ".packlist" \ |
126 |
-o -name "*.bs" \ |
127 |
|xargs -i rm -f {} |
128 |
|
129 |
# no empty directories |
130 |
find %{buildroot}%{_prefix} \ |
131 |
-type d -depth \ |
132 |
-exec rmdir {} \; 2>/dev/null |
133 |
|
134 |
%{__perl} -MFile::Find -le ' |
135 |
find({ wanted => \&wanted, no_chdir => 1}, "%{buildroot}"); |
136 |
print "%doc ReadMe"; |
137 |
for my $x (sort @dirs, @files) { |
138 |
push @ret, $x unless indirs($x); |
139 |
} |
140 |
print join "\n", sort @ret; |
141 |
|
142 |
sub wanted { |
143 |
return if /auto$/; |
144 |
|
145 |
local $_ = $File::Find::name; |
146 |
my $f = $_; s|^\Q%{buildroot}\E||; |
147 |
return unless length; |
148 |
return $files[@files] = $_ if -f $f; |
149 |
|
150 |
$d = $_; |
151 |
/\Q$d\E/ && return for reverse sort @INC; |
152 |
$d =~ /\Q$_\E/ && return |
153 |
for qw|/etc %_prefix/man %_prefix/bin %_prefix/share|; |
154 |
|
155 |
$dirs[@dirs] = $_; |
156 |
} |
157 |
|
158 |
sub indirs { |
159 |
my $x = shift; |
160 |
$x =~ /^\Q$_\E\// && $x ne $_ && return 1 for @dirs; |
161 |
} |
162 |
' > %filelist |
163 |
|
164 |
[ -z %filelist ] && { |
165 |
echo "ERROR: empty %files listing" |
166 |
exit -1 |
167 |
} |
168 |
|
169 |
%clean |
170 |
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} |
171 |
|
172 |
%files -f %filelist |
173 |
%defattr(-,root,root) |
174 |
|
175 |
%changelog |
176 |
* Sun Apr 29 2007 Shad L. Lords <slords@mail.com> |
177 |
- Clean up spec so package can be built by koji/plague |
178 |
|
179 |
* Thu Dec 07 2006 Shad L. Lords <slords@mail.com> |
180 |
- Update to new release naming. No functional changes. |
181 |
- Make Packager generic |
182 |
|
183 |
* Mon Sep 20 2004 charlieb@charlieb-centos |
184 |
- Initial build. |