Stevan Little wrote:
David,
...
If you would please give a real-world-useful example of this usage of
class-methods, I am sure I could show you, what I believe, is a better
approach that does not use class methods.
...
The example I've wanted to code in Java is along the lines of:
public class Base {
public static main(String[] args) {
init();
do_it(args);
cleanup()
}
}
and then define a bunch of derived classes as my main class.
public class Derived extends Base {
static init() { print("doing init"); }
static do_it(String[] args) { print("doing body"); }
static cleanup() { print("doing cleanup"); }
}
% javac Derived
% java Derived
In other words, I wanted to not have a main function on the class that I
run as the application.
This example, of course, doesn't apply to Perl -- but I think that the
basic pattern is still useful