Scalar::Defer 0.07
Sponsored Links
Scalar::Defer 0.07 Ranking & Summary
File size:
0.025 MB
Platform:
Any Platform
License:
MIT/X Consortium License
Price:
Downloads:
1101
Date added:
2006-10-18
Publisher:
Audrey Tang
Scalar::Defer 0.07 description
Scalar::Defer is a Perl module to calculate values on demand.
SYNOPSIS
use Scalar::Defer; # exports defer and lazy
my ($x, $y);
my $dv = defer { ++$x }; # a deferred value (not memoized)
my $lv = lazy { ++$y }; # a lazy value (memoized)
print "$dv $dv $dv"; # 1 2 3
print "$lv $lv $lv"; # 1 1 1
my $forced = force $dv; # force a normal value out of $dv
print "$forced $forced $forced"; # 4 4 4
This module exports two functions, defer and lazy, for building values that are evaluated on demand. It also exports a force function to force evaluation of a deferred value.
defer {...}
Takes a block or a code reference, and returns a deferred value. Each time that value is demanded, the block is evaluated again to yield a fresh result.
lazy {...}
Like defer, except the value is computed at most once. Subsequent evaluation will simply use the cached result.
force $value
Force evaluation of a deferred value to return a normal value. If $value was already normal value, then force simply returns it.
NOTES
Deferred values are not considered objects (ref on them returns 0), although you can still call methods on them, in which case the invocant is always the forced value.
Unlike the tie-based Data::Lazy, this module operates on values, not variables. Therefore, assigning into $dv and $lv above will simply replace the value, instead of triggering a STORE method call.
Also, thanks to the overload-based implementation, this module is about 2x faster than Data::Lazy.
SYNOPSIS
use Scalar::Defer; # exports defer and lazy
my ($x, $y);
my $dv = defer { ++$x }; # a deferred value (not memoized)
my $lv = lazy { ++$y }; # a lazy value (memoized)
print "$dv $dv $dv"; # 1 2 3
print "$lv $lv $lv"; # 1 1 1
my $forced = force $dv; # force a normal value out of $dv
print "$forced $forced $forced"; # 4 4 4
This module exports two functions, defer and lazy, for building values that are evaluated on demand. It also exports a force function to force evaluation of a deferred value.
defer {...}
Takes a block or a code reference, and returns a deferred value. Each time that value is demanded, the block is evaluated again to yield a fresh result.
lazy {...}
Like defer, except the value is computed at most once. Subsequent evaluation will simply use the cached result.
force $value
Force evaluation of a deferred value to return a normal value. If $value was already normal value, then force simply returns it.
NOTES
Deferred values are not considered objects (ref on them returns 0), although you can still call methods on them, in which case the invocant is always the forced value.
Unlike the tie-based Data::Lazy, this module operates on values, not variables. Therefore, assigning into $dv and $lv above will simply replace the value, instead of triggering a STORE method call.
Also, thanks to the overload-based implementation, this module is about 2x faster than Data::Lazy.
Scalar::Defer 0.07 Screenshot
Scalar::Defer 0.07 Keywords
Defer 0.07
to calculate
Perl module
calculate values
value
module
values
dv
force
lv
Scalar::Defer
ScalarDefer
Scalar::Defer 0.07
Libraries
Programming
Bookmark Scalar::Defer 0.07
Scalar::Defer 0.07 Copyright
WareSeeker periodically updates pricing and software information of Scalar::Defer 0.07 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Scalar::Defer 0.07 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
nada used car values
used car values
home values
car values
coin values
blue book value
american values
value city furniture
human values
comic book values
valuesoft
sports card values
trading card values
classic car values
gun values
value city department store
true value hardware
value city furniture store
Related Software
Scalar::Number is a Perl module with numeric aspects of scalars. Free Download
Scalar::Footnote is a Perl module that can attach hidden scalars to references. Free Download
Scalar::MultiValue is a Perl module to create a SCALAR with multiple values. Free Download
Scalar::Properties is a Perl module package that contains run-time properties on scalar variables. Free Download
Set::Scalar Perl module contains a basic set of operations. Free Download
HTML::BBReverse is a Perl module to convert HTML to BBCode and back. Free Download
Class::DataStore is a Perl module for generic OO data storage/retrieval. Free Download
Tk::SlideShow is a Tk Perl module for building slide-like presentations. Free Download
Latest Software
Popular Software
Favourite Software