Blessed References
Explore how Perl's object system uses blessed references to create objects. Understand the role of the bless function in associating references with classes, and learn how constructors initialize objects. This lesson clarifies Perl's minimal rules for object-oriented programming and discusses practical usage patterns including safer attribute access.
We'll cover the following...
We'll cover the following...
Perl object system
Perl’s core object system is deliberately minimal. It has only three rules:
A class is a package.
A method is a function.
A (blessed) reference is an object.
We can build anything else out of these three rules. This minimalism can be impractical for larger projects, in particular, the possibilities for greater abstraction through ...