Cor jest alternatywnym systemem OOP dla Perla

Zobacz link do porównania Cor i Moose. Przykładowy kod:

klasa Punkt {
ma ( $x, $y ) :reader :writer :new :isa(Int);

metoda clear() {
( $x, $y ) = ( 0, 0 );
}
}

klasa Point3D isa Point {
ma $z :reader :writer :new :isa(Int);

metoda clear() {
$self->next::method;
$z = 0;
}
}

Źródło: linux.org.ru

Dodaj komentarz