Hi there,
I've just discovered the means of OOP in Perl and got a newbie question...
I've defined a class with attributes like this:
sub new { my $class = shift; my $s = {}; bless $s, $class;
$s->{Laboratory} = new MotionSensorB('Laboratory', 'senMotion_H2_S1
+');
$s->{Fruitcellar} = new MotionSensorA('Fruitcellar', 'senMotion_H1_S1
+');
return $s;
}
In the same package I want to loop through the attributes, that is, access the elements Laboratory and Fruitcellar:
sub event { my $c = shift;
foreach my ??? (???) {
print ??? . "\n";
}
I'm not so firm with arrays, hashes, references etc. and trying all sorts of combinations, but can't get it right.
How can I achieve it?