Bubblegum::Object::Universal - Common Methods for Operating on Defined Values
version 0.34
use Bubblegum; my $thing = 0; $thing->instance; # bless({'data' => 0}, 'Bubblegum::Object::Instance')
Universal methods work on variables whose data meets the criteria for being defined. It is not necessary to use this module as it is loaded automatically by the Bubblegum class.
my $thing = '...'; $thing->digest; # bless({'data' => '...'}, 'Bubblegum::Wrapper::Digest') my $data = $thing->digest->data;
The digest method blesses the subject into the wrapper class, Bubblegum::Wrapper::Digest, and returns an instance. Please see Bubblegum::Wrapper::Digest for more information.
my $thing = '...'; $thing->dumper; # bless({'data' => '...'}, 'Bubblegum::Wrapper::Dumper') my $data = $thing->dumper->data;
The dumper method blesses the subject into the wrapper class, Bubblegum::Wrapper::Dumper, and returns an instance. Please see Bubblegum::Wrapper::Dumper for more information.
my $thing = '...'; $thing->encoder; # bless({'data' => '...'}, 'Bubblegum::Wrapper::Encoder') my $data = $thing->encoder->data;
The encoder method blesses the subject into the wrapper class, Bubblegum::Wrapper::Encoder, and returns an instance. Please see Bubblegum::Wrapper::Encoder for more information.
my $thing = 0; $thing->instance; # bless({'data' => 0}, 'Bubblegum::Object::Instance') my $data = $thing->instance->data;
The instance method blesses the subject into a generic container class, Bubblegum::Object::Instance, and returns an instance. Please see Bubblegum::Object::Instance for more information.
my $thing = '...'; $thing->json; # bless({'data' => '...'}, 'Bubblegum::Wrapper::Json') my $data = $thing->json->data;
The json method blesses the subject into the wrapper class, Bubblegum::Wrapper::Json, and returns an instance. Please see Bubblegum::Wrapper::Json for more information.
my $thing = [1,0]; $thing->wrapper('json'); $thing->json; # bless({'data' => [1,0]}, 'Bubblegum::Wrapper::Json') my $json = $thing->json->encode;
The wrapper method blesses the subject into a Bubblegum wrapper, a container class, which exists as an extension to the core data type methods, and returns an instance. Please see any one of the core Bubblegum wrappers, e.g., Bubblegum::Wrapper::Digest, Bubblegum::Wrapper::Dumper, Bubblegum::Wrapper::Encoder, Bubblegum::Wrapper::Json or Bubblegum::Wrapper::Yaml.
my $thing = '...'; $thing->yaml; # bless({'data' => '...'}, 'Bubblegum::Wrapper::Yaml') my $data = $thing->yaml->data;
The yaml method blesses the subject into the wrapper class, Bubblegum::Wrapper::Yaml, and returns an instance. Please see Bubblegum::Wrapper::Yaml for more information.
All data type objects have access to type assertions methods which can be call on to help ensure data integrity and prevent invalid usage patterns. The following is a list of standard type assertion methods whose routines map to those corresponding in the Types::Standard library.
my $thing = undef; $thing->asa_aref;
The aref method asserts that the caller is an array reference. If the caller is not an array reference, the program will die.
my $thing = undef; $thing->asa_arrayref;
The arrayref method asserts that the caller is an array reference. If the caller is not an array reference, the program will die.
my $thing = undef; $thing->asa_bool;
The bool method asserts that the caller is a boolean value. If the caller is not a boolean value, the program will die.
my $thing = undef; $thing->asa_boolean;
The boolean method asserts that the caller is a boolean value. If the caller is not a boolean value, the program will die.
my $thing = undef; $thing->asa_class;
The class method asserts that the caller is a class name. If the caller is not a class name, the program will die.
my $thing = undef; $thing->asa_classname;
The classname method asserts that the caller is a class name. If the caller is not a class name, the program will die.
my $thing = undef; $thing->asa_coderef;
The coderef method asserts that the caller is a code reference. If the caller is not a code reference, the program will die.
my $thing = undef; $thing->asa_cref;
The cref method asserts that the caller is a code reference. If the caller is not a code reference, the program will die.
my $thing = undef; $thing->asa_def;
The def method asserts that the caller is a defined value. If the caller is not a defined value, the program will die.
my $thing = undef; $thing->asa_defined;
The defined method asserts that the caller is a defined value. If the caller is not a defined value, the program will die.
my $thing = undef; $thing->asa_fh;
The fh method asserts that the caller is a file handle. If the caller is not a file handle, the program will die.
my $thing = undef; $thing->asa_filehandle;
The filehandle method asserts that the caller is a file handle. If the caller is not a file handle, the program will die.
my $thing = undef; $thing->asa_glob;
The glob method asserts that the caller is a glob reference. If the caller is not a glob reference, the program will die.
my $thing = undef; $thing->asa_globref;
The globref method asserts that the caller is a glob reference. If the caller is not a glob reference, the program will die.
my $thing = undef; $thing->asa_hashref;
The hashref method asserts that the caller is a hash reference. If the caller is not a hash reference, the program will die.
my $thing = undef; $thing->asa_href;
The href method asserts that the caller is a hash reference. If the caller is not a hash reference, the program will die.
my $thing = undef; $thing->asa_int;
The int method asserts that the caller is an integer. If the caller is not an integer, the program will die.
my $thing = undef; $thing->asa_integer;
The integer method asserts that the caller is an integer. If the caller is not an integer, the program will die.
my $thing = undef; $thing->asa_num;
The num method asserts that the caller is a number. If the caller is not a number, the program will die.
my $thing = undef; $thing->asa_number;
The number method asserts that the caller is a number. If the caller is not a number, the program will die.
my $thing = undef; $thing->asa_obj;
The obj method asserts that the caller is an object. If the caller is not an object, the program will die.
my $thing = undef; $thing->asa_object;
The object method asserts that the caller is an object. If the caller is not an object, the program will die.
my $thing = undef; $thing->asa_ref;
The ref method asserts that the caller is a reference. If the caller is not a reference, the program will die.
my $thing = undef; $thing->asa_reference;
The reference method asserts that the caller is a reference. If the caller is not a reference, the program will die.
my $thing = undef; $thing->asa_regexpref;
The regexpref method asserts that the caller is a regular expression reference. If the caller is not a regular expression reference, the program will die.
my $thing = undef; $thing->asa_rref;
The rref method asserts that the caller is a regular expression reference. If the caller is not a regular expression reference, the program will die.
my $thing = undef; $thing->asa_scalarref;
The scalarref method asserts that the caller is a scalar reference. If the caller is not a scalar reference, the program will die.
my $thing = undef; $thing->asa_sref;
The sref method asserts that the caller is a scalar reference. If the caller is not a scalar reference, the program will die.
my $thing = undef; $thing->asa_str;
The str method asserts that the caller is a string. If the caller is not a string, the program will die.
my $thing = undef; $thing->asa_string;
The string method asserts that the caller is a string. If the caller is not a string, the program will die.
my $thing = undef; $thing->asa_nil;
The nil method asserts that the caller is an undefined value. If the caller is not an undefined value, the program will die.
my $thing = undef; $thing->asa_null;
The null method asserts that the caller is an undefined value. If the caller is not an undefined value, the program will die.
my $thing = undef; $thing->asa_undef;
The undef method asserts that the caller is an undefined value. If the caller is not an undefined value, the program will die.
my $thing = undef; $thing->asa_undefined;
The undefined method asserts that the caller is an undefined value. If the caller is not an undefined value, the program will die.
my $thing = undef; $thing->asa_val;
The val method asserts that the caller is a value. If the caller is not a value, the program will die.
my $thing = undef; $thing->asa_value;
The value method asserts that the caller is a value. If the caller is not a value, the program will die.
All data type objects have access to type checking methods which can be call on to help control the flow of operations. The following is a list of standard type checking methods whose routines map to those corresponding in the Types::Standard library.
my $thing = undef; $thing->isa_aref;
The aref method checks that the caller is an array reference. If the caller is not an array reference, the method will return false.
my $thing = undef; $thing->isa_arrayref;
The arrayref method checks that the caller is an array reference. If the caller is not an array reference, the method will return false.
my $thing = undef; $thing->isa_bool;
The bool method checks that the caller is a boolean value. If the caller is not a boolean value, the method will return false.
my $thing = undef; $thing->isa_boolean;
The boolean method checks that the caller is a boolean value. If the caller is not a boolean value, the method will return false.
my $thing = undef; $thing->isa_class;
The class method checks that the caller is a class name. If the caller is not a class name, the method will return false.
my $thing = undef; $thing->isa_classname;
The classname method checks that the caller is a class name. If the caller is not a class name, the method will return false.
my $thing = undef; $thing->isa_coderef;
The coderef method checks that the caller is a code reference. If the caller is not a code reference, the method will return false.
my $thing = undef; $thing->isa_cref;
The cref method checks that the caller is a code reference. If the caller is not a code reference, the method will return false.
my $thing = undef; $thing->isa_def;
The def method checks that the caller is a defined value. If the caller is not a defined value, the method will return false.
my $thing = undef; $thing->isa_defined;
The defined method checks that the caller is a defined value. If the caller is not a defined value, the method will return false.
my $thing = undef; $thing->isa_fh;
The fh method checks that the caller is a file handle. If the caller is not a file handle, the method will return false.
my $thing = undef; $thing->isa_filehandle;
The filehandle method checks that the caller is a file handle. If the caller is not a file handle, the method will return false.
my $thing = undef; $thing->isa_glob;
The glob method checks that the caller is a glob reference. If the caller is not a glob reference, the method will return false.
my $thing = undef; $thing->isa_globref;
The globref method checks that the caller is a glob reference. If the caller is not a glob reference, the method will return false.
my $thing = undef; $thing->isa_hashref;
The hashref method checks that the caller is a hash reference. If the caller is not a hash reference, the method will return false.
my $thing = undef; $thing->isa_href;
The href method checks that the caller is a hash reference. If the caller is not a hash reference, the method will return false.
my $thing = undef; $thing->isa_int;
The int method checks that the caller is an integer. If the caller is not an integer, the method will return false.
my $thing = undef; $thing->isa_integer;
The integer method checks that the caller is an integer. If the caller is not an integer, the method will return false.
my $thing = undef; $thing->isa_num;
The num method checks that the caller is a number. If the caller is not a number, the method will return false.
my $thing = undef; $thing->isa_number;
The number method checks that the caller is a number. If the caller is not a number, the method will return false.
my $thing = undef; $thing->isa_obj;
The obj method checks that the caller is an object. If the caller is not an object, the method will return false.
my $thing = undef; $thing->isa_object;
The object method checks that the caller is an object. If the caller is not an object, the method will return false.
my $thing = undef; $thing->isa_ref;
The ref method checks that the caller is a reference. If the caller is not a reference, the method will return false.
my $thing = undef; $thing->isa_reference;
The reference method checks that the caller is a reference. If the caller is not a reference, the method will return false.
my $thing = undef; $thing->isa_regexpref;
The regexpref method checks that the caller is a regular expression reference. If the caller is not a regular expression reference, the method will return false.
my $thing = undef; $thing->isa_rref;
The rref method checks that the caller is a regular expression reference. If the caller is not a regular expression reference, the method will return false.
my $thing = undef; $thing->isa_scalarref;
The scalarref method checks that the caller is a scalar reference. If the caller is not a scalar reference, the method will return false.
my $thing = undef; $thing->isa_sref;
The sref method checks that the caller is a scalar reference. If the caller is not a scalar reference, the method will return false.
my $thing = undef; $thing->isa_str;
The str method checks that the caller is a string. If the caller is not a string, the method will return false.
my $thing = undef; $thing->isa_string;
The string method checks that the caller is a string. If the caller is not a string, the method will return false.
my $thing = undef; $thing->isa_nil;
The nil method checks that the caller is an undefined value. If the caller is not an undefined value, the method will return false.
my $thing = undef; $thing->isa_null;
The null method checks that the caller is an undefined value. If the caller is not an undefined value, the method will return false.
my $thing = undef; $thing->isa_undef;
The undef method checks that the caller is an undefined value. If the caller is not an undefined value, the method will return false.
my $thing = undef; $thing->isa_undefined;
The undefined method checks that the caller is an undefined value. If the caller is not an undefined value, the method will return false.
my $thing = undef; $thing->isa_val;
The val method checks that the caller is a value. If the caller is not a value, the method will return false.
my $thing = undef; $thing->isa_value;
The value method checks that the caller is a value. If the caller is not a value, the method will return false.
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.