in reply to Objects with Private Variables
But the user has no way at all of accessing or modifying your data fields unless you've defined an accessor method.Not quite. You can still go "under the hood" from outside of the module:
my $person = new Person; $person->name("Foo Bar"); $person->age(22); # No 'toes' method $person->("toes", 12); print $person->name, " is ", $person->age, " years old.\n"; print "And has ", $person->("toes"), " toes\n";
In Section
Tutorials