mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-29 05:38:00 +00:00
- Add p5-constant-defer 6
constant::defer creates a subroutine which on the first call runs given code to calculate its value, and on any subsequent calls just returns that value, like a constant. The value code is discarded once run, allowing it to be garbage collected. Deferring a calculation is good if it might take a lot of work or produce a big result but is only needed sometimes or only well into a program run. If it's never needed then the value code never runs. A deferred constant is generally not inlined or folded (see "Constant Folding" in perlop) since it's not a single scalar value. In the current implementation a deferred constant becomes a plain constant after the first use, so may inline etc in code compiled after that (see "IMPLEMENTATION" below). WWW: http://search.cpan.org/dist/constant-defer/
This commit is contained in:
parent
cdf02c1098
commit
440fa2dcaf
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=384782
@ -3239,6 +3239,7 @@
|
||||
SUBDIR += p5-constant
|
||||
SUBDIR += p5-constant-boolean
|
||||
SUBDIR += p5-constant-def
|
||||
SUBDIR += p5-constant-defer
|
||||
SUBDIR += p5-constant-lexical
|
||||
SUBDIR += p5-cpan-listchanges
|
||||
SUBDIR += p5-enum
|
||||
|
18
devel/p5-constant-defer/Makefile
Normal file
18
devel/p5-constant-defer/Makefile
Normal file
@ -0,0 +1,18 @@
|
||||
# Created by: Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= constant-defer
|
||||
PORTVERSION= 6
|
||||
CATEGORIES= devel perl5
|
||||
MASTER_SITES= CPAN
|
||||
PKGNAMEPREFIX= p5-
|
||||
|
||||
MAINTAINER= sunpoet@FreeBSD.org
|
||||
COMMENT= Constant subs with deferred value calculation
|
||||
|
||||
LICENSE= GPLv3
|
||||
|
||||
USE_PERL5= configure
|
||||
USES= perl5
|
||||
|
||||
.include <bsd.port.mk>
|
2
devel/p5-constant-defer/distinfo
Normal file
2
devel/p5-constant-defer/distinfo
Normal file
@ -0,0 +1,2 @@
|
||||
SHA256 (constant-defer-6.tar.gz) = 7b21263198ca22686efff3ae987a240be423dd2160afdeb29fe716d032986ffa
|
||||
SIZE (constant-defer-6.tar.gz) = 43427
|
15
devel/p5-constant-defer/pkg-descr
Normal file
15
devel/p5-constant-defer/pkg-descr
Normal file
@ -0,0 +1,15 @@
|
||||
constant::defer creates a subroutine which on the first call runs given code to
|
||||
calculate its value, and on any subsequent calls just returns that value, like a
|
||||
constant. The value code is discarded once run, allowing it to be garbage
|
||||
collected.
|
||||
|
||||
Deferring a calculation is good if it might take a lot of work or produce a big
|
||||
result but is only needed sometimes or only well into a program run. If it's
|
||||
never needed then the value code never runs.
|
||||
|
||||
A deferred constant is generally not inlined or folded (see "Constant Folding"
|
||||
in perlop) since it's not a single scalar value. In the current implementation a
|
||||
deferred constant becomes a plain constant after the first use, so may inline
|
||||
etc in code compiled after that (see "IMPLEMENTATION" below).
|
||||
|
||||
WWW: http://search.cpan.org/dist/constant-defer/
|
2
devel/p5-constant-defer/pkg-plist
Normal file
2
devel/p5-constant-defer/pkg-plist
Normal file
@ -0,0 +1,2 @@
|
||||
%%SITE_PERL%%/constant/defer.pm
|
||||
%%PERL5_MAN3%%/constant::defer.3.gz
|
Loading…
Reference in New Issue
Block a user