NAME
Venus::Role::Testable - Testable Role
ABSTRACT
Testable Role for Perl 5
SYNOPSIS
package Example;
use Venus::Class;
with 'Venus::Role::Testable';
has 'value';
sub execute {
return pop;
}
package main;
my $example = Example->new;
# $example->istrue(sub{0});
DESCRIPTION
This package modifies the consuming package and provides methods for dispatching method calls and returning truthy returns as true and falsy returns as false boolean values.
METHODS
This package provides the following methods:
isfalse
isfalse(Str | CodeRef $method, Any @args) (Bool)
The isfalse method dispatches the method call or executes the callback and returns truthy returns as false
and falsy returns as true
"boolean" values.
Since 0.08
- isfalse example 1
-
package main; my $example = Example->new; my $true = $example->isfalse(execute => 0); # 1
- isfalse example 2
-
package main; my $example = Example->new; my $true = $example->isfalse(sub{0}); # 1
- isfalse example 3
-
package main; my $example = Example->new; my $false = $example->isfalse(execute => 1); # 0
istrue
istrue(Str | CodeRef $method, Any @args) (Bool)
The istrue method dispatches the method call or executes the callback and returns truthy returns as true
and falsy returns as false
"boolean" values.
Since 0.08
- istrue example 1
-
package main; my $example = Example->new; my $true = $example->istrue(execute => 1); # 1
- istrue example 3
-
package main; my $example = Example->new; my $false = $example->istrue(execute => 0); # 0
AUTHORS
Cpanery, cpanery@cpan.org
LICENSE
Copyright (C) 2021, Cpanery
Read the "license" file.