Files
perl-load/perl-load.spec
2025-08-12 18:15:05 +02:00

96 lines
3.2 KiB
RPMSpec

#
# spec file for package perl-load
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define cpan_name load
Name: perl-load
Version: 0.260.0
Release: 0
# 0.26 -> normalize -> 0.260.0
%define cpan_version 0.26
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Load - control when subroutines will be loaded
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/L/LN/LNATION/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
Provides: perl(load) = %{version}
%undefine __perllib_provides
%{perl_requires}
%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.
The "load" pragma combines the best of both worlds from AutoLoader and
SelfLoader. And adds some more features.
In a situation where you want to use as little memory as possible, the
"load" pragma (in the context of a module) is a drop-in replacement for
AutoLoader. But for situations where you want to have a module load
everything it could ever possibly need (e.g. when starting a mod_perl
server in pre-fork mode), the "load" pragma can be used (in the context of
an application) to have all subroutines of a module loaded without having
to make any change to the source of the module in question.
So the typical use inside a module is to have:
package Your::Module;
use load;
in the source. And to place all subroutines that you want to be loadable on
demand after the (first) __END__.
If an application developer decides that all subroutines should be loaded
at compile time, (s)he can say in the application:
use load 'now';
use Your::Module;
This will cause the subroutines of Your::Module to all be loaded at compile
time.
%prep
%autosetup -n %{cpan_name}-%{cpan_version} -p1
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc CHANGELOG README TODO VERSION
%changelog