Cor - alternatívny OOP systém pre Perl

Pozrite si odkaz na porovnanie Cor a Moose. Vzorový kód:

trieda Bod {
has ( $x, $y ) :reader :writer :new :isa(Int);

metóda clear() {
( $x, $y) = (0, 0);
}
}

class Point3D isa Point {
má $z :reader :writer :new :isa(Int);

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

Zdroj: linux.org.ru

Pridať komentár