http://www.perlmonks.org?node_id=1007114


in reply to perl oop concept

By all means, don’t make this a voyage of discovery.   Read the various perldocs on OOP in Perl, and seek out a few recent Perl modules at http://search.cpan.org.   Read the source code of some of them.   (Or just look at the modules already installed on your own system.)   Copy their practices exactly.

Remember the essence of what bless does:   it associates a package-name with some data-object.   It thereby enables the $foo->subname vernacular to be used.   Perl knows to look in the associated package to find the routine, and it calls that routine with $foo as the first parameter.   That’ s basically it.   The data object didn’t cease to be what it is ... the rules for accessing it as a data object haven’t really changed ... it’s merely wearing a halo now, and glowing slightly (and wearing a beneficent smile ...).

(Am I simplifying?   Of course.   But not really over-simplifying, all in the name of simple clarity.)