-
-
09 Mar 2005 02:03:59 UTC
- Distribution: Tie-LazyFunction
- Module version: 0.01
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (494 / 0 / 0)
- Kwalitee
Bus factor: 0- 52.17% Coverage
- License: unknown
- Activity
24 month- Tools
- Download (2.39KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Tie::LazyFunction - sugar to defer evaluation in a tied scalar
SYNOPSIS
use Tie::LazyFunction; tie my $lazyvar, Tie::LazyFunction => sub { something we want to defer }, $arg1var, $arg2var, ... $ #variables which will hold arguments to the sub ;
DESCRIPTION
This short module facilitates binding a coderef to a scalar in such a way that the coderef will be evaluated when the value of the scalar is taken.
When six or fewer arguments are specified after the coderef at tie time, the arguments are not evaluated until they are evaluated within the code. With seven or more arguments, arguments are evaluated at function call time and passed by value.
All arguments are referred to by reference only until FETCH time.
EXPORT
nothing
HISTORY
0.01
written in response to discusison of simple lazy variables on perl-5 porters mailing list
FUTURE
It is frustrating that there is no complementary operation to @Refs = \( @Scalars ) aside from @Derefs = map { $$_ } @Refs which fetches the references instead of simply dereferencing them.
AUTHOR
Copyright (C) 2005 david nicol davidnico@cpan.org released under your choice of the GNU Public or Artistic licenses
SEE ALSO
Data::Lazy provides much more than this does
Tie::Function makes function calls look like hash lookups
Module Install Instructions
To install Tie::LazyFunction, copy and paste the appropriate command in to your terminal.
cpanm Tie::LazyFunction
perl -MCPAN -e shell install Tie::LazyFunction
For more information on module installation, please visit the detailed CPAN module installation guide.