The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bubblegum::Object::Universal - Common Methods for Operating on Defined Values

VERSION

version 0.11

SYNOPSIS

    use Bubblegum;

    my $thing = 0;
    $thing->instance; # bless({'data' => 0}, 'Bubblegum::Object::Instance')

DESCRIPTION

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.

METHODS

instance

    my $thing = 0;
    $thing->instance; # bless({'data' => 0}, 'Bubblegum::Object::Instance')

    my $data = $thing->instance->data; # 0

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.

wrapper

    my $thing = [1,0];
    $thing->wrapper('json'); # same as ...
    $thing->json; # bless({'data' => [1,0]}, 'Bubblegum::Wrapper::Json')

    my $json = $thing->json->encode; # [1,0]

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.

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.