]>
Commit | Line | Data |
---|---|---|
560582e4 JR |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | # | |
5 | %define pdir Lexical | |
6 | %define pnam Persistence | |
560582e4 JR |
7 | Summary: Lexical::Persistence - Persistent lexical variable values for arbitrary calls. |
8 | Name: perl-Lexical-Persistence | |
9 | Version: 1.020 | |
10 | Release: 1 | |
11 | License: GPL v1+ or Artistic | |
12 | Group: Development/Languages/Perl | |
13 | Source0: http://www.cpan.org/modules/by-module/Lexical/%{pdir}-%{pnam}-%{version}.tar.gz | |
14 | # Source0-md5: 22fc0a2486c6746bdd1a635f42889809 | |
15 | URL: http://search.cpan.org/dist/Lexical-Persistence/ | |
16 | BuildRequires: perl-devel >= 1:5.8.0 | |
17 | BuildRequires: rpm-perlprov >= 4.1-13 | |
18 | %if %{with tests} | |
19 | BuildRequires: perl-Devel-LexAlias >= 0.04 | |
20 | BuildRequires: perl-PadWalker >= 1.1 | |
21 | %endif | |
22 | BuildArch: noarch | |
23 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
24 | ||
25 | %description | |
26 | Lexical::Persistence does a few things, all related. Note that all | |
27 | the behaviors listed here are the defaults. Subclasses can override | |
28 | nearly every aspect of Lexical::Persistence's behavior. | |
29 | ||
30 | Lexical::Persistence lets your code access persistent data through | |
31 | lexical variables. This example prints "some value" because the value | |
32 | of $x perists in the $lp object between setter() and getter(). | |
33 | ||
34 | use Lexical::Persistence; | |
35 | ||
36 | my $lp = Lexical::Persistence->new(); | |
37 | $lp->call(\&setter); | |
38 | $lp->call(\&getter); | |
39 | ||
40 | sub setter { my $x = "some value" } | |
41 | sub getter { print my $x, "\n" } | |
42 | ||
43 | Lexicals with leading underscores are not persistent. | |
44 | ||
45 | By default, Lexical::Persistence supports accessing data from multiple | |
46 | sources through the use of variable prefixes. The set_context() | |
47 | member sets each data source. It takes a prefix name and a hash of | |
48 | key/value pairs. By default, the keys must have sigils representing | |
49 | their variable types. | |
50 | ||
51 | %prep | |
52 | %setup -q -n %{pdir}-%{pnam}-%{version} | |
53 | ||
54 | %build | |
55 | %{__perl} Makefile.PL \ | |
56 | INSTALLDIRS=vendor | |
57 | %{__make} | |
58 | ||
59 | %{?with_tests:%{__make} test} | |
60 | ||
61 | %install | |
62 | rm -rf $RPM_BUILD_ROOT | |
63 | ||
64 | %{__make} pure_install \ | |
65 | DESTDIR=$RPM_BUILD_ROOT | |
66 | ||
67 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
68 | cp -a eg $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
69 | ||
70 | %clean | |
71 | rm -rf $RPM_BUILD_ROOT | |
72 | ||
73 | %files | |
74 | %defattr(644,root,root,755) | |
75 | %doc CHANGES README | |
76 | %dir %{perl_vendorlib}/Lexical | |
77 | %{perl_vendorlib}/Lexical/*.pm | |
78 | %{_mandir}/man3/* | |
79 | %{_examplesdir}/%{name}-%{version} |