NAME
Data::Object::Autobox - An Autobox Implementation for Perl 5
VERSION
version 0.03
STATUS
SYNOPSIS
use Data::Object::Autobox;
my $input = [1,1,1,1,3,3,2,1,5,6,7,8,9];
my $output = $input->grep('$a < 5')->unique->sort; # [1,2,3]
$output->isa('Data::Object::Array');
$output->join(', '); # 1,2,3
DESCRIPTION
Data::Object::Autobox implements autoboxing via autobox to provide boxing for native Perl 5 data types. This functionality is provided by Data::Object which provides a collection of object classes for handling SCALAR, ARRAY, HASH, CODE, INTEGER, FLOAT, NUMBER, STRING, UNDEF, and UNIVERSAL data type operations. Data::Object provides its own boxing strategy in that every method call which would normally return a native data type will return a data type object, but this functionality requires an initial data type object. Data::Object::Autobox makes it so that you do not need to explicitly create the initial data type object, and once the initial autobox method call is made, the Data::Object boxing takes over. Note: This is an early release available for testing and feedback and as such is subject to change.
Array Methods
Array methods are called on array references, for example, using $array->method(@args), which will act on the $array reference and will
return a new data type object. Many array methods are simply wrappers around
core functions, but there are additional operations and modifications to core
behavior. Array methods are handled via the Data::Object::Array object class
which is provided to the autobox ARRAY option.
Code Methods
Code methods are called on code references, for example, using $code->method(@args), which will act on the $code reference and will
return a new data type object. Many code methods are simply wrappers around
core functions, but there are additional operations and modifications to core
behavior. Code methods are handled via the Data::Object::Code object class
which is provided to the autobox CODE option.
Float Methods
Float methods are called on float values, for example, using $float->method(@args), which will act on the $float value and will
return a new data type object. Many float methods are simply wrappers around
core functions, but there are additional operations and modifications to core
behavior. Float methods are handled via the Data::Object::Float object class
which is provided to the autobox FLOAT option.
Hash Methods
Hash methods are called on hash references, for example, using $hash->method(@args), which will act on the $hash reference and will
return a new data type object. Many hash methods are simply wrappers around
core functions, but there are additional operations and modifications to core
behavior. Hash methods are handled via the Data::Object::Hash object class
which is provided to the autobox HASH option.
Integer Methods
Integer methods are called on integer values, for example, using $integer->method(@args), which will act on the $integer value and will
return a new data type object. Many integer methods are simply wrappers around
core functions, but there are additional operations and modifications to core
behavior. Integer methods are handled via the Data::Object::Integer object
class which is provided to the autobox INTEGER option.
Number Methods
Number methods are called on number values, for example, using $number->method(@args), which will act on the $number value and will
return a new data type object. Many number methods are simply wrappers around
core functions, but there are additional operations and modifications to core
behavior. Number methods are handled via the Data::Object::Number object
class which is provided to the autobox NUMBER option.
Scalar Methods
Scalar methods are called on scalar references and values, for example, using
$scalar->method(@args), which will act on the $scalar reference and
will return a new data type object. Many scalar methods are simply wrappers
around core functions, but there are additional operations and modifications to
core behavior. Scalar methods are handled via the Data::Object::Scalar object
class which is provided to the autobox SCALAR option.
String Methods
String methods are called on string values, for example, using $string->method(@args), which will act on the $string value and will
return a new data type object. Many string methods are simply wrappers around
core functions, but there are additional operations and modifications to core
behavior. String methods are handled via the Data::Object::String object
class which is provided to the autobox STRING option.
Undef Methods
Undef methods are called on undef values, for example, using $undef->method(@args), which will act on the $undef value and will
return a new data type object. Many undef methods are simply wrappers around
core functions, but there are additional operations and modifications to core
behavior. Undef methods are handled via the Data::Object::Undef object
class which is provided to the autobox STRING option.
Universal Methods
Universal methods can be called on any values, for example, using $universal->method(@args), which will act on the reference or value and will
return a new data type object. Many universal methods are simply wrappers around
core functions, but there are additional operations and modifications to core
behavior. Universal methods are handled via the Data::Object::Universal
object class which is provided to the autobox UNIVERSAL option.
SEE ALSO
- Data::Object::Array
- Data::Object::Code
- Data::Object::Float
- Data::Object::Hash
- Data::Object::Integer
- Data::Object::Number
- Data::Object::Scalar
- Data::Object::String
- Data::Object::Undef
- Data::Object::Universal
AUTHOR
Al Newkirk anewkirk@ana.io
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 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.