Class::Classless

Class::Classless is a Perl framework for classless OOP.
Download

Class::Classless Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Sean M. Burke
  • Publisher web site:
  • http://search.cpan.org/~sburke/

Class::Classless Tags


Class::Classless Description

Class::Classless is a Perl framework for classless OOP. Class::Classless is a Perl framework for classless OOP.SYNOPSIS use strict; use Class::Classless; my $ob1 = $Class::Classless::ROOT->clone; $ob1->{'NAME'} = 'Ob1'; $ob1->{'stuff'} = 123; $ob1->{'Thing'} = 789; my $ob2 = $ob1->clone; $ob2->{'NAME'} = 'Ob2'; printf "ob1 stuff: n", $ob1->{'stuff'}; printf "ob2 stuff: n", $ob2->{'stuff'}; printf "ob1 Thing: n", $ob1->{'Thing'}; printf "ob2 Thing: n", $ob2->{'Thing'}; $ob1->{'METHODS'}{'zaz'} = sub { print "Zaz! on ", $_{'NAME'}, "n"; }; $ob1->zaz; $ob2->zaz; $ob1->EXAMINE; $ob2->EXAMINE;This prints the following: ob1 stuff: < 123 > ob2 stuff: < 123 > ob1 Thing: < 789 > ob2 Thing: < > Zaz! on Ob1 Zaz! on Ob2 < Class::Classless::X=HASH(0x200236f4) > 'stuff', 123, 'NAME', 'Ob1', 'Thing', 789, 'METHODS', { 'zaz', 'CODE(0x20068360)' }, 'PARENTS', , < Class::Classless::X=HASH(0x2002cb48) > 'stuff', 123, 'NAME', 'Ob2', 'METHODS', { }, 'PARENTS', , In class-based OOP frameworks, methods are applicable to objects by virtue of objects belonging to classes that either provide those methods, or inherit them from classes that do.In classless OOP frameworks (AKA delegation-and-prototypes frameworks), what methods an object is capable of is basically an attribute of that object. That is, in Perl terms: instead of methods being entries in the symbol table of the package/class the object belongs to, they are entries in a hash table inside the object. Inheritance is implemented not by having classes inheriting from other classes (via ISA lists), but by having objects inherit from other objects (via PARENTS lists).In class-based OOP frameworks, you get new objects by calling constructors. In a classless framework, you get new objects by copying ("cloning") an existing object -- and the new clone becomes a child (inheritor) of the original object. (Where do you get the one original object? The language provides one, which has no parents, and which contains some general purpose methods like "clone".) Requirements: · Perl


Class::Classless Related Software