Encapsulation is one of the cornerstones of
object orientation, but it's the area in which Perl's support for object-oriented
programming is weakest. Many would argue that enforced encapsulation is against
Perl's philosophy of freedom and flexibility in programming. However, there are
situations when too much freedom becomes a trap, and too much flexibility makes
it hard to build solid code. Fortunately, Perl's flexibility can be turned against
itself to provide a means of building objects that respect the encapsulation imposed
by their classes.