The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lazy::Bool::Cached - Boolean wrapper lazy with memoize

SYNOPSIS

  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.

DESCRIPTION

This class extends Lazy::Bool

Functions

lzbc

Helper to create an instance

  use Lazy::Bool::Cached qw(lzbc);

  my $a = 6;
  my $b = 4;
  my $condition = lzbc { $a > $b };
        

EXPORT

This package can export the helper lzbc to easily create a new instance of Lazy::Bool::Cached

SEE ALSO

Lazy::Bool, Scalar::Lazy and Scalar::Defer

AUTHOR

Tiago Peczenyj, <tiago.peczenyj@gmail.com>

COPYRIGHT AND LICENSE

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.