in reply to class static member
There are two kinds of members: methods and attributes.
Methods
There is no difference between a static method and one that isn't in Perl, except how its called.
vspackage MyClass; sub method { my ($self, ...) = @_; ... } $obj->method(...);
package MyClass; sub static_method { my ($class, ...) = @_; ... } MyClass->static_method(...);
Attributes
Static attributes are just package variables.
package MyClass; our $static_attrib; $MyClass::static_attrib = 1; print($MyClass::static_attrib, "\n");
|
|---|