How would I call attributes? Specifically, what if I'm calling a list
attribute from a scalar object?
my Dog $spot; my Dog @pack; $spot->@.legs; # INCORRECT (I hope) [EMAIL PROTECTED]; # INCORRECT? @spot.legs; # What if you also have @spot declared?
This question is a little bit like asking how you can detect a hard link...
Attributes themselves are inaccessible from outside the class. All you can get at is their accessor (if they have one), which is a normal method called the normal way:
$spot.legs; # Could be for $.legs, @.legs, or %.legs
Which actually brings up an interesting question:
class Silly { has $.thing=1; has @.thing=(2, 3); has %.thing=(4 => 5, 6 => 7); } my $silly=new Silly(); say $silly.thing.class; #Int, Array, or Hash?
-- Brent "Dax" Royal-Gordon <[EMAIL PROTECTED]> Perl and Parrot hacker
Oceania has always been at war with Eastasia.