How should I define 'static' subroutines in Perl?

Viewed 5207

I'm used to work in Java, so perhaps this question is a Java-oriented Perl question... anyway, I've created a Person package using Moose.

Now, I would like to add a few subroutines which are "static", that is, they do not refer to a specific Person, but are still closely related to Person package. For example, sub sort_persons gets an array of Person objects.

In Java, I would simply declare such functions as static. But in Perl... what is the common way to do that?

p.s. I think the Perlish terminology for what I'm referring to is "class methods".

1 Answers
Related