|
|
|
|
|
by silvestrov
4171 days ago
|
|
Look at how much boilerplate code you need in Perl 5 to create a class versus C++/Java's simple class MyClass { } You need to assign to a variable named @ISA, you need to return 1; at the bottom of the file. And 'public' members have to be listed in the EXPORT variable. It is really funny that Perl 5 OO need more boilerplate code than Java! |
|
And here's the boiler plate for more modern perl:
You can define properties of the class using has 'property'; This will setup any accessors and also handle initializing them in the constructor that's created for you by default.