%define real_name Thread-Tie

Summary:        Tie variables into a thread of their own
Name:           perl-Thread-Tie
Version:        0.13
Release:        2%{?_dist_release}
License:        Artistic or GPL+
Group:          Development/Libraries
URL:            http://search.cpan.org/dist/Thread-Tie/

Source:         http://search.cpan.org/CPAN/authors/id/E/EL/ELIZABETH/Thread-Tie-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch:      noarch

BuildRequires:  perl(ExtUtils::MakeMaker)
BuildRequires:  perl(Thread::Serialize) >= 0.07
BuildRequires:  perl(load) >= 0.11
Requires:       perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires:       perl(Thread::Serialize) >= 0.07
Requires:       perl(load) >= 0.11

%description
The standard shared variable scheme used by Perl, is based on tie-ing
the variable to some very special dark magic. This dark magic ensures
that shared variables, which are copied just as any other variable
when a thread is started, update values in all of the threads where 
they exist as soon as the value of a shared variable is changed.

Needless to say, this could use some improvement.

The Thread::Tie module is a proof-of-concept implementation of another
approach to shared variables. Instead of having shared variables exist 
in all the threads from which they are accessible, shared variable 
exist as "normal", unshared variables in a seperate thread. Only a 
tied object exists in each thread from which the shared variable is 
accesible.

Through the use of a client-server model, any thread can fetch and/or 
update variables living in that thread. This client-server 
functionality is hidden under the hood of tie().


This module only functions on Perl versions 5.8.0 and later.
And then only when threads are enabled with -Dusethreads.  It
is of no use with any version of Perl before 5.8.0 or without
threads enabled.

%prep
%setup -q -n %{real_name}-%{version}

%build
%{expand: %%define optflags %{optflags} -fPIC}
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
find %{buildroot} -depth -type d -exec rmdir {} ';' 2>/dev/null
%{_fixperms} %{buildroot}

%check
make test

%clean
rm -rf %{buildroot}

%files
%defattr(-, root, root, 0755)
%doc MANIFEST README CHANGELOG TODO
%{perl_vendorlib}/*
%{_mandir}/man3/*

%changelog
* Sat Oct 11 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 0.13-2
- rebuild with perl 5.16.3
- moved to Development/Libraries Group

* Sat Mar 10 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.13-1
- initial build for Vine Linux
