GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Data::Object::Boolean(3) User Contributed Perl Documentation Data::Object::Boolean(3)

Data::Object::Boolean

Boolean Class for Perl 5

  package main;

  use Data::Object::Boolean;

  my $bool = Data::Object::Boolean->new; # false

This package provides functions and representation for boolean values.

This package inherits behaviors from:

Data::Object::Kind

This package uses type constraints from:

Data::Object::Types

This package implements the following functions:

  False() : Object

The False method returns a boolean object representing false.

False example #1
  Data::Object::Boolean::False(); # false
    

  IsFalse(Maybe[Any] $arg) : Object

The IsFalse method returns a boolean object representing false if no arugments are passed, otherwise this function will return a boolean object based on the argument provided.

IsFalse example #1
  Data::Object::Boolean::IsFalse(); # true
    
IsFalse example #2
  Data::Object::Boolean::IsFalse(0); # true
    
IsFalse example #3
  Data::Object::Boolean::IsFalse(1); # false
    

  IsTrue() : Object

The IsTrue method returns a boolean object representing truth if no arugments are passed, otherwise this function will return a boolean object based on the argument provided.

IsTrue example #1
  Data::Object::Boolean::IsTrue(); # false
    
IsTrue example #2
  Data::Object::Boolean::IsTrue(1); # true
    
IsTrue example #3
  Data::Object::Boolean::IsTrue(0); # false
    

  TO_JSON(Any $arg) : Ref['SCALAR']

The TO_JSON method 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.

TO_JSON example #1
  my $bool = Data::Object::Boolean->new(1);

  $bool->TO_JSON; # \1
    
TO_JSON example #2
  Data::Object::Boolean::TO_JSON(
    Data::Object::Boolean::True()
  );

  # \1
    
TO_JSON example #3
  my $bool = Data::Object::Boolean->new(0);

  $bool->TO_JSON(0); # \0
    
TO_JSON example #4
  Data::Object::Boolean::TO_JSON(
    Data::Object::Boolean::False()
  );

  # \0
    

  True() : Object

The True method returns a boolean object representing truth.

True example #1
  Data::Object::Boolean::True(); # true
    

  Type() : Str

The Type method returns either "True" or "False" based on the truthiness or falsiness of the argument provided.

Type example #1
  Data::Object::Boolean::Type(); # False
    
Type example #2
  Data::Object::Boolean::Type(1); # True
    
Type example #3
  Data::Object::Boolean::Type(0); # False
    
Type example #4
  Data::Object::Boolean::Type(
    Data::Object::Boolean::True()
  );

  # True
    
Type example #5
  Data::Object::Boolean::Type(
    Data::Object::Boolean::False()
  );

  # False
    

This package implements the following methods:

  new(Maybe[Any] $arg) : Object

The new method returns a boolean object based on the value of the argument provided.

new example #1
  my $bool = Data::Object::Boolean->new(1); # true
    
new example #2
  my $bool = Data::Object::Boolean->new(0); # false
    
new example #3
  my $bool = Data::Object::Boolean->new(''); # false
    
new example #4
  my $bool = Data::Object::Boolean->new(undef); # false
    

Al Newkirk, "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 terms of the The Apache License, Version 2.0, as elucidated in the "license file" <https://github.com/iamalnewkirk/data-object/blob/master/LICENSE>.

Wiki <https://github.com/iamalnewkirk/data-object/wiki>

Project <https://github.com/iamalnewkirk/data-object>

Initiatives <https://github.com/iamalnewkirk/data-object/projects>

Milestones <https://github.com/iamalnewkirk/data-object/milestones>

Contributing <https://github.com/iamalnewkirk/data-object/blob/master/CONTRIBUTE.md>

Issues <https://github.com/iamalnewkirk/data-object/issues>

2020-04-27 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.