Bubblegum
view release on metacpan or search on metacpan
lib/Bubblegum/Prototype.pm view on Meta::CPAN
The object function, exported by Bubblegum::Prototype, creates an anonymous
class object (blessed hashref), derived from L<Bubblegum::Prototype::Instance>.
The function can optionally take a list of key/value pairs. The keys with values
which are code references will be implemented as class methods, otherwise
will be implemented as class attributes.
my $shrek = object
name => 'Shrek',
filepath => '/path/to/shrek',
lastseen => sub { (stat(shift->filepath))[8] },
directors => ['Andrew Adamson', 'Vicky Jenson'],
actors => ['Mike Myers', 'Eddie Murphy', 'Cameron Diaz'],
;
As previously stated, with prototype-based programming, reuse is commonly
achieved by extending prototypes (i.e. cloning existing objects which also serve
as templates). The extend function, also exported by Bubblegum::Prototype,
creates an anonymous class object (blessed hashref), derived from the specified
class or object.
( run in 0.727 second using v1.01-cache-2.11-cpan-49f99fa48dc )