Al Newkirk > Bubblegum > Bubblegum::Object::Undef

Download:
Bubblegum-0.45.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.45   Source  

NAME ^

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

VERSION ^

version 0.45

SYNOPSIS ^

    use Bubblegum;

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

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 Bubblegum class.

METHODS ^

defined

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

The defined method always returns false.

COERCIONS ^

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 empty array reference.

to_a

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

The to_a method coerces a number to an array value. This method returns an empty array reference.

to_code

    my $undef = undef;
    my $result = $undef->to_code; # sub { $undef }

The to_code method coerces a number to a code value. The code reference, when executed, will return the subject.

to_c

    my $undef = undef;
    my $result = $undef->to_c; # sub { $undef }

The to_c method coerces a number to a code value. The code reference, when executed, will return the subject.

to_hash

    my $undef = undef;
    my $result = $undef->to_hash; # {}

The to_hash method coerces a number to a hash value. This method returns an empty hash reference.

to_h

    my $undef = undef;
    my $result = $undef->to_h; # {}

The to_h method coerces a number to a hash value. This method returns an empty hash reference.

to_number

    my $undef = undef;
    my $result = $undef->to_number; # 0

The to_number method coerces a number to a number value. This method returns the number zero.

to_n

    my $undef = undef;
    my $result = $undef->to_n; # 0

The to_n method coerces a number to a number value. This method returns the number zero.

to_string

    my $undef = undef;
    my $result = $undef->to_string; # ""

The to_string method coerces a number to a string value. This method returns an empty string.

to_s

    my $undef = undef;
    my $result = $undef->to_s; # ""

The to_s method coerces a number to a string value. This method returns an empty string.

to_undef

    my $undef = undef;
    my $result = $undef->to_undef; # undef

The to_undef method coerces a number to an undef value. This method merely returns an undef value.

to_u

    my $undef = undef;
    my $result = $undef->to_u; # undef

The to_u method coerces a number to an undef value. This method merely returns an undef value.

SEE ALSO ^

AUTHOR ^

Al Newkirk <anewkirk@ana.io>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Al Newkirk.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: