%define real_name load

Summary: Control when subroutines will be loaded
Name:           perl-%{real_name}
Version:        0.20
Release:        1%{?_dist_release}
License:        Artistic or GPL+
Group:          Development/Libraries
URL:            http://search.cpan.org/dist/load/
Source:         http://www.cpan.org/authors/id/E/EL/ELIZABETH/load-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root

BuildArch:      noarch
BuildRequires:  perl
BuildRequires:  perl(ExtUtils::MakeMaker)
Requires:       perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))

%description
The "load" pragma allows a module developer to give the application
developer more options with regards to optimize for memory or CPU 
usage. The "load" pragma gives more control on the moment when 
subroutines are loaded and start taking up memory. This allows the 
application developer to optimize for CPU usage (by loading all of a
module at compile time and thus reducing the amount of CPU used during
the execution of an application). Or allow the application developer 
to optimize for memory usage, by loading subroutines only when they 
are actually needed, thereby however increasing the amount of CPU 
needed during execution.

%prep
%setup -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, -)
%doc MANIFEST README CHANGELOG TODO
%doc %{_mandir}/man3/load.3pm*
%{perl_vendorlib}/load.pm

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