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:

Venus::Kind::Value

METHODS

This package provides the following methods:

default

default() (Bool)

The default method returns the default value, i.e. 0.

Since 0.01

default example 1
# given: synopsis;

my $default = $boolean->default;

# 0

is_false

is_false() (Bool)

The is_false method returns false if the boolean is falsy, otherwise returns true.

Since 0.01

is_false example 1
# given: synopsis;

my $is_false = $boolean->is_false;

# 1

is_true

is_true() (Bool)

The is_true method returns true if the boolean is truthy, otherwise returns false.

Since 0.01

is_true example 1
# given: synopsis;

my $is_true = $boolean->is_true;

# 0

negate

negate() (Bool)

The negate method returns true if the boolean is falsy, otherwise returns false.

Since 0.01

negate example 1
# given: synopsis;

my $negate = $boolean->negate;

# 1

type

type() (Str)

The type method returns the word 'true' if the boolean is truthy, otherwise returns 'false'.

Since 0.01

type example 1
# given: synopsis;

my $type = $boolean->type;

# "false"

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 bool operator.

example 1

# given: synopsis;

my $result = !!$boolean;

# 0
operation: (eq)

This package overloads the eq operator.

example 1

# given: synopsis;

my $result = $boolean eq '0';

# 1
operation: (ne)

This package overloads the ne operator.

example 1

# given: synopsis;

my $result = $boolean ne '1';

# 1
operation: (qr)

This package overloads the qr operator.

example 1

# given: synopsis;

my $result = '0' =~ qr/$boolean/;

# 1

AUTHORS

Cpanery, cpanery@cpan.org

LICENSE

Copyright (C) 2021, Cpanery

Read the "license" file.