package Ca; # Großbuchstabe vorne dran! use strict; use warnings; use base qw(Class::Accessor); __PACKAGE__->mk_accessors(qw(instability)); #our $instability = 4; # wird im Konstruktor gesetzt. =head1 METHODS =head2 new( $dimension, $iniTime, $finTime, $rndInit, $useNorth, $useDiagonal ) TODO: Deine Beschreibung des Objetes, das man mit new() konstruiert, hier. =cut sub new { my $class = shift; my ( $dimension, $iniTime, $finTime, $rndInit, $useNorth, $useDiagonal ) = @_; # TODO: Prüfen der Argumente my @cellList = (); my $some_data = { dim => $dimension, iniTime => $iniTime, finTime => $finTime, rndInit => $rndInit, useNorth => $useNorth, useDiagnoal => $useDiagonal, cellList => \@cellList, # alternativ: anonyme Arrayreferenz #cellList => [], }; my $self = bless ($some_data, $class); # init instability: $self->instability(4); # get this value anywhere else by calling my $inst = $obj->instability(); $self->addCells(); $self->addCellsNeighbors(); return $self; } # /new 1; # Semikolon dran!