Bubblegum

 view release on metacpan or  search on metacpan

lib/Bubblegum/Object/Undef.pm  view on Meta::CPAN

# ABSTRACT: Common Methods for Operating on Undefined Values
package Bubblegum::Object::Undef;

use 5.10.0;
use namespace::autoclean;

use Bubblegum::Class 'with';

with 'Bubblegum::Object::Role::Item';
with 'Bubblegum::Object::Role::Coercive';

our @ISA = (); # non-object

our $VERSION = '0.45'; # VERSION

sub defined {
    return 0
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Bubblegum::Object::Undef - Common Methods for Operating on Undefined Values

=head1 VERSION

version 0.45

=head1 SYNOPSIS

    use Bubblegum;

    my $nothing = undef;
    say $nothing->defined ? 'Yes' : 'No'; # No

=head1 DESCRIPTION

Undefined methods work on variables whose data meets the criteria for being
undefined. It is not necessary to use this module as it is loaded automatically
by the L<Bubblegum> class.

=head1 METHODS

=head2 defined

    my $nothing = undef;
    $nothing->defined ? 'Yes' : 'No'; # No

The defined method always returns false.

=head1 COERCIONS

=head2 to_array

    my $undef = undef;
    my $result = $undef->to_array; # []

The to_array method coerces a number to an array value. This method returns an



( run in 1.791 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )