Data::Object::Boolean
Data-Object Boolean Class
use Data::Object::Boolean; my $bool; $bool = Data::Object::Boolean->new; # false $bool = Data::Object::Boolean->new(1); # true $bool = Data::Object::Boolean->new(0); # false $bool = Data::Object::Boolean->new(''); # false $bool = Data::Object::Boolean->new(undef); # false
This package provides functions and representation for boolean values.
This package implements the following functions.
False() : Object
The False function returns a boolean object representing false.
Data::Object::Boolean::False(); # false
IsFalse(Maybe[Any] $arg) : Object
The IsFalse function returns a boolean object representing false if no arugments are passed, otherwise this function will return a boolean object based on the argument provided.
Data::Object::Boolean::IsFalse(); # false Data::Object::Boolean::IsFalse($value); # true/false
IsTrue() : Object
The IsTrue function returns a boolean object representing truth if no arugments are passed, otherwise this function will return a boolean object based on the argument provided.
Data::Object::Boolean::IsTrue(); # true Data::Object::Boolean::IsTrue($value); # true/false
TO_JSON(Any $arg) : Ref['SCALAR']
The TO_JSON function returns a scalar ref representing truthiness or falsiness based on the arguments passed. This function is commonly used by JSON encoders and instructs them on how they should represent the value.
Data::Object::Boolean::TO_JSON($true); # \1 Data::Object::Boolean::TO_JSON($false); # \0
True() : Object
The True function returns a boolean object representing truth.
Data::Object::Boolean::True(); # true
Type() : Object
The Type function returns either "True" or "False" based on the truthiness or falsiness of the argument provided.
Data::Object::Boolean::Type($value); # "True" or "False"
This package implements the following methods.
new(Any $arg) : Object
The new method returns a boolean object based on the value of the argument provided.
my $bool; $bool = Data::Object::Boolean->new; # false $bool = Data::Object::Boolean->new(1); # true $bool = Data::Object::Boolean->new(0); # false $bool = Data::Object::Boolean->new(''); # false $bool = Data::Object::Boolean->new(undef); # false
Al Newkirk, +309
+309
Anthony Brummett, +10
+10
Adam Hopkins, +2
+2
José Joaquín Atria, +1
+1
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To get the most out of this distribution, consider reading the following:
Do
Data::Object
Data::Object::Class
Data::Object::ClassHas
Data::Object::Role
Data::Object::RoleHas
Data::Object::Library
To install Do, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Do
CPAN shell
perl -MCPAN -e shell install Do
For more information on module installation, please visit the detailed CPAN module installation guide.