Bubblegum::Object::Undef - Common Methods for Operating on Undefined Values
version 0.45
use Bubblegum; my $nothing = undef; say $nothing->defined ? 'Yes' : 'No'; # No
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.
my $nothing = undef; $nothing->defined ? 'Yes' : 'No'; # No
The defined method always returns false.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Bubblegum::Object::Array
Bubblegum::Object::Code
Bubblegum::Object::Hash
Bubblegum::Object::Instance
Bubblegum::Object::Integer
Bubblegum::Object::Number
Bubblegum::Object::Scalar
Bubblegum::Object::String
Bubblegum::Object::Undef
Bubblegum::Object::Universal
Al Newkirk <anewkirk@ana.io>
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.
To install Bubblegum, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bubblegum
CPAN shell
perl -MCPAN -e shell install Bubblegum
For more information on module installation, please visit the detailed CPAN module installation guide.