Venus::Boolean - Boolean Class
Boolean Class for Perl 5
package main; use Venus::Boolean; my $boolean = Venus::Boolean->new; # $boolean->negate;
This package provides a representation for boolean values.
This package inherits behaviors from:
Venus::Kind::Value
This package provides the following methods:
default() (Bool)
The default method returns the default value, i.e. 0.
0
Since 0.01
0.01
# given: synopsis; my $default = $boolean->default; # 0
is_false() (Bool)
The is_false method returns false if the boolean is falsy, otherwise returns true.
false
true
# given: synopsis; my $is_false = $boolean->is_false; # 1
is_true() (Bool)
The is_true method returns true if the boolean is truthy, otherwise returns false.
# given: synopsis; my $is_true = $boolean->is_true; # 0
negate() (Bool)
The negate method returns true if the boolean is falsy, otherwise returns false.
# given: synopsis; my $negate = $boolean->negate; # 1
type() (Str)
The type method returns the word 'true' if the boolean is truthy, otherwise returns 'false'.
'true'
'false'
# given: synopsis; my $type = $boolean->type; # "false"
This package overloads the following operators:
(!)
This package overloads the ! operator.
!
example 1
# given: synopsis; my $result = !$boolean; # 1
(<)
This package overloads the < operator.
<
# given: synopsis; my $result = $boolean < 1; # 1
(<=)
This package overloads the <= operator.
<=
# given: synopsis; my $result = $boolean <= 0; # 1
(
This package overloads the > operator.
# given: synopsis; my $result = $boolean > 0; # 0
This package overloads the => operator.
# given: synopsis; my $result = $boolean >= 0; # 1
(!=)
This package overloads the != operator.
!=
# given: synopsis; my $result = $boolean != 1; # 1
(==)
This package overloads the == operator.
==
# given: synopsis; my $result = $boolean == 0; # 1
(bool)
This package overloads the bool operator.
bool
# given: synopsis; my $result = !!$boolean; # 0
(eq)
This package overloads the eq operator.
eq
# given: synopsis; my $result = $boolean eq '0'; # 1
(ne)
This package overloads the ne operator.
ne
# given: synopsis; my $result = $boolean ne '1'; # 1
(qr)
This package overloads the qr operator.
qr
# given: synopsis; my $result = '0' =~ qr/$boolean/; # 1
Cpanery, cpanery@cpan.org
cpanery@cpan.org
Copyright (C) 2021, Cpanery
Read the "license" file.
To install Venus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Venus
CPAN shell
perl -MCPAN -e shell install Venus
For more information on module installation, please visit the detailed CPAN module installation guide.