NAME
Venus::Boolean - Boolean Class
ABSTRACT
Boolean Class for Perl 5
SYNOPSIS
package main;
use Venus::Boolean;
my $boolean = Venus::Boolean->new;
# $boolean->negate;
DESCRIPTION
This package provides a representation for boolean values.
INHERITS
This package inherits behaviors from:
METHODS
This package provides the following methods:
default
default() (Bool)
The default method returns the default value, i.e. 0.
Since 0.01
is_false
is_false() (Bool)
The is_false method returns false if the boolean is falsy, otherwise returns true.
Since 0.01
is_true
is_true() (Bool)
The is_true method returns true if the boolean is truthy, otherwise returns false.
Since 0.01
negate
negate() (Bool)
The negate method returns true if the boolean is falsy, otherwise returns false.
Since 0.01
type
type() (Str)
The type method returns the word 'true' if the boolean is truthy, otherwise returns 'false'.
Since 0.01
OPERATORS
This package overloads the following operators:
- operation:
(!) -
This package overloads the
!operator.example 1
# given: synopsis; my $result = !$boolean; # 1
- operation:
(<) -
This package overloads the
<operator.example 1
# given: synopsis; my $result = $boolean < 1; # 1
- operation:
(<=) -
This package overloads the
<=operator.example 1
# given: synopsis; my $result = $boolean <= 0; # 1
- operation:
()> -
This package overloads the
> operator.example 1
# given: synopsis; my $result = $boolean > 0; # 0
- operation:
(=)> -
This package overloads the
=> operator.example 1
# given: synopsis; my $result = $boolean >= 0; # 1
- operation:
(!=) -
This package overloads the
!=operator.example 1
# given: synopsis; my $result = $boolean != 1; # 1
- operation:
(==) -
This package overloads the
==operator.example 1
# given: synopsis; my $result = $boolean == 0; # 1
- operation:
(bool) -
This package overloads the
booloperator.example 1
# given: synopsis; my $result = !!$boolean; # 0
- operation:
(eq) -
This package overloads the
eqoperator.example 1
# given: synopsis; my $result = $boolean eq '0'; # 1
- operation:
(ne) -
This package overloads the
neoperator.example 1
# given: synopsis; my $result = $boolean ne '1'; # 1
- operation:
(qr) -
This package overloads the
qroperator.example 1
# given: synopsis; my $result = '0' =~ qr/$boolean/; # 1
AUTHORS
Cpanery, cpanery@cpan.org
LICENSE
Copyright (C) 2021, Cpanery
Read the "license" file.