Author image Robert Rothenberg
and 1 contributors

NAME

Logic::Kleene - Kleene three-valued logic

SYNOPSIS

  use Logic::Kleene;

  $a = !kleene( somefunction() );

  if ($a && $b) { ... } 

DESCRIPTION

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.

AUTHOR

Robert Rothenberg <rrwo at cpan.org>

Suggestions and Bug Reporting

Feedback is always welcome. Please use the CPAN Request Tracker at http://rt.cpan.org to submit bug reports.

LICENSE

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.