Bubblegum
view release on metacpan or search on metacpan
FEATURES
* Requires 5.10.0
* Enforces Strict Syntax and Enables Warnings
* Exception Handling for Type Operations
* Extendable Component-Based Autoboxing
* Encoding and Decoding Utilities
* UTF-8 Encoding For All IO Operations
* Modern Method Order Resolution
* Modern Minimalistic Object System
* Functional and Object-Oriented Type Checking
* Extendable with Optional Features and Enhancements
RATIONALE
The TIMTOWTDI (there is more than one way to do it) motto has been a
gift and a curse. The Perl language (and community) has been centered
around this concept for quite some time, in that the language "doesn't
try to tell the programmer how to program" which makes it easy to write
concise and powerful statements but which also makes it easy to write
extremely messy and incoherent software (with great power comes great
responsibility). Another downside is that as the number of decisions a
programmer has to make increases, their productivity decreases. Enforced
consistency is a path many other programming languages and frameworks
have adopted to great effect, so Bubblegum is one approach towards that
end in Perl.
Bubblegum Extras
Additional features and enhancements can be enabled by using utility
packages such as Bubblegum::Constraints, which exports type constraint
and validation functions. Bubblegum is a Perl development framework;
having it's feature-set compartmentalized in such a way as to allow the
maximum amount of interoperability. Bubblegum can be used along-side any
of the many object-systems.
use Bubblegum::Class;
use Bubblegum::Constraints -isas;
sub BUILDARGS {
my $class = shift;
my $data = isa_hashref $_[0] ? $_[0] : {@_};
# do stuff
# ...
return $data;
}
Bubblegum Topology
Bubblegum type classes are built as extensions to the autobox type
classes. The following is the custom autobox type, subtype and roles
hierarchy. All native data types inherit their functionality from the
universal class, then whichever autobox subtype class is appropriate and
so on. Bubblegum overlays object-roles on top of this design to enforce
constraints and consistency. The following is the current layout of the
object roles and relationships. Note, this will likely evolve.
INSTANCE -+
[ROLE] VALUE
|
UNDEF -+
[ROLE] ITEM
|
UNIVERSAL -+
[ROLE] DEFINED
|
+- SCALAR -+
| [ROLE] VALUE
| |
| +- NUMBER -+
| | [ROLE] VALUE
| | |
| | +- INTEGER
| | | [ROLE] VALUE
| | |
| | +- FLOAT
| | [ROLE] VALUE
| |
| +- STRING
| [ROLE] VALUE
|
+- ARRAY
| [ROLE] REF
| [ROLE] LIST
| [ROLE] INDEXED
|
+- HASH
| [ROLE] REF
| [ROLE] KEYED
|
+- CODE
[ROLE] VALUE
Bubblegum Operations
The following classes have methods which can be invoked by variables
containing data of a type corresponding with the type the class is
designed to handle.
Array Operations
Array operations work on arrays and array references. Please see
Bubblegum::Object::Array for more information on operations associated
with array references.
Code Operations
Code operations work on code references. Please see
Bubblegum::Object::Code for more information on operations associated
with code references.
Hash Operations
Hash operations work on hash and hash references. Please see
Bubblegum::Object::Hash for more information on operations associated
with hash references.
Integer Operations
( run in 0.674 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )