3 %bcond_without tests # do not perform "make test"
7 Summary: Readonly::XS - Companion module for Readonly.pm, to speed up read-only scalar variables
12 License: GPL v1+ or Artistic
13 Group: Development/Languages/Perl
14 Source0: http://www.cpan.org/modules/by-module/Readonly/%{pdir}-%{pnam}-%{version}.tar.gz
15 # Source0-md5: df71f29abfcbd14c963f912d6d6ded6b
16 URL: http://search.cpan.org/dist/Readonly-XS/
17 BuildRequires: perl-devel >= 1:5.8.0
18 BuildRequires: rpm-perlprov >= 4.1-13
20 BuildRequires: perl-Readonly >= 1.02
22 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
25 The Readonly module (q.v.) is an effective way to create
26 non-modifiable variables. However, it's relatively slow.
28 The reason it's slow is that is implements the read-only-ness of
29 variables via tied objects. This mechanism is inherently slow. Perl
30 simply has to do a lot of work under the hood to make tied variables
33 This module corrects the speed problem, at least with respect to
34 scalar variables. When Readonly::XS is installed, Readonly uses it to
35 access the internals of scalar variables. Instead of creating a scalar
36 variable object and tying it, Readonly simply flips the SvREADONLY bit
37 in the scalar's FLAGS structure.
39 Readonly arrays and hashes are not sped up by this, since the
40 SvREADONLY flag only works for scalars. Arrays and hashes always use
43 Why implement this as a separate module? Because not everyone can use
44 XS. Not everyone has a C compiler. Also, installations with a
45 statically-linked perl may not want to recompile their perl binary
46 just for this module. Rather than render Readonly.pm useless for these
47 people, the XS portion was put into a separate module.
50 %setup -q -n %{pdir}-%{pnam}-%{version}
53 %{__perl} Makefile.PL \
57 OPTIMIZE="%{rpmcflags}"
59 %{?with_tests:%{__make} test}
62 rm -rf $RPM_BUILD_ROOT
64 %{__make} pure_install \
65 DESTDIR=$RPM_BUILD_ROOT
68 rm -rf $RPM_BUILD_ROOT
71 %defattr(644,root,root,755)
73 %dir %{perl_vendorarch}/Readonly/
74 %{perl_vendorarch}/Readonly/*.pm
75 %dir %{perl_vendorarch}/auto/Readonly
76 %dir %{perl_vendorarch}/auto/Readonly/XS
77 %attr(755,root,root) %{perl_vendorarch}/auto/Readonly/XS/*.so