Well, “Perl does objects just a little bit sideways.” Here are the key notions:
-
Perl lets you define packages of subroutines, such that you can use packagename and, having done so, call a routine in it.
-
You can bless any variable to associate it with a package, so that $varname->subname(args...) becomes a call to a routine in the associated package (hand-waving here), which package Perl figures-out on its own; with $varname as the implied first argument.
- By convention (and nothing else), packages may contain a subroutine named new which creates a data structure, blesses it, and returns it to you. This subroutine of course is called using a package syntax, referring to the desired package directly.
And then... there is Moose ... :-}