Logic::Kleene - Kleene three-valued logic
use Logic::Kleene; $a = !kleene( somefunction() ); if ($a && $b) { ... }
This module implements Kleene three-valued logic via overloading.
The third value is between true and false, and is equivalent to an undefined value (as when a program has not yet returned a value).
The significant different is that the negation of an undefined value is still undefined (and so treated as false). For example,
my $status = kleene(somefunction()); if (!$status) { print "somefunction failed"; }
If the status value is false, then it will print the failure message, as expected. But if the status is undefined, then it will not print the message.
It is important to note that
kleene(!$x)
is not equivalent to
!kleene($x)
since in the first case, $x may not be a Kleene value.
$x
Robert Rothenberg <rrwo at cpan.org>
Feedback is always welcome. Please use the CPAN Request Tracker at http://rt.cpan.org to submit bug reports.
Copyright (c) 2005 Robert Rothenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Logic::Kleene, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Logic::Kleene
CPAN shell
perl -MCPAN -e shell install Logic::Kleene
For more information on module installation, please visit the detailed CPAN module installation guide.