Lazy::Bool::Cached - Boolean wrapper lazy with memoize
use Lazy::Bool::Cached; my $result = Lazy::Bool::Cached->new(sub{ # complex boolean expression }); #... if($result) { # now we evaluate the expression } if($result) { # do not evaluate again. it is cached. } # Using this module you can play with lazy booleans. # With expressions '&', '|' and '!' you can delay the expression evaluation until necessary.
This class extends Lazy::Bool
Helper to create an instance
use Lazy::Bool::Cached qw(lzbc); my $a = 6; my $b = 4; my $condition = lzbc { $a > $b };
This package can export the helper lzbc to easily create a new instance of Lazy::Bool::Cached
Lazy::Bool, Scalar::Lazy and Scalar::Defer
Tiago Peczenyj, <tiago.peczenyj@gmail.com>
Copyright (C) 2013 by Tiago Peczenyj
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.
To install Lazy::Bool, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lazy::Bool
CPAN shell
perl -MCPAN -e shell install Lazy::Bool
For more information on module installation, please visit the detailed CPAN module installation guide.