Oryx::Parent - multiple inheritance meta-type for Oryx
package Fruit; use base qw(Oryx::Class); our $schema = { attributes => [{ colour => 'String', }], } 1; package Food; use base qw(Oryx::Class); our $schema = { attributes => [{ energy => 'Float', }], } 1; package Orange; use base qw(Fruit Food); our $schema = { attributes => [{ segments => 'Integer', }] } 1; use Orange; my $orange = Orange->create({ segments => 10, energy => 543.21, colour => 'orange', }); $orange->update; $orange->commit; my $id = $orange->id; undef $orange; my $retrieved = Orange->retrieve($id); print $retrieved->colour; # prints 'orange' my $food_instance = $retrieved->PARENT('Food'); print $food_instance->energy; # prints 543.21 $food_instance->energy(42.00); $food_instance->update; my $changed_orange = Orange->retrieve($id); print $changed_orange->energy; # prints 42.00 (parent instance updated)
Oryx::Parent objects are constructed during Oryx::Class initialization by inspecting your class' @ISA array, so you get one of these hanging off your class for each superclass that is also an Oryx::Class derivative.
@ISA
To install Oryx, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Oryx
CPAN shell
perl -MCPAN -e shell install Oryx
For more information on module installation, please visit the detailed CPAN module installation guide.