NAME
CHI::Cascade::Value - a class for valid values
SYNOPSIS
You can use it class for a returning of values by exceptions. For example:
die CHI::Cascade::Value->new
This throws an exception with nothing value. If you do it from your recompute code your CHI::Cascade::run method will return an old value from cache or if it's not in cache it will return an undef
value.
Or
die CHI::Cascade::Value->new->value( $any_value );
die CHI::Cascade::Value->new->value( undef );
This throws an exception with valid value. Please note that undef
is valid value too! But bacause the CHI::Cascade::run method returns only a value (not instance of CHI::Cascade::Value object) there is not recommended to use undef
values (run
method returns undef
when it cannot get a value right now).
Please use it class only in special cases - when you need to break recopmuting, want to return an specific value only for once execution of CHI::Cascade::run method and don't want to save value in cache.
CONSTRUCTOR
$value = CHI::Cascade::Value->new;
It will create instance $value with nothing value
METHODS
- $value->value
- $value->value( $new_value )
-
You can use it to get/set a value of $value. An
undef
value is valid too! First version returns a value, second sets a value and returns$value
. - $value->is_value
-
returns
true
if value was set by value method orfalse
else.
AUTHOR
This module has been written by Perlover <perlover@perlover.com>
LICENSE
This module is free software and is published under the same terms as Perl itself.