Keith Devens .com |
Thursday, November 20, 2008 | ![]() |
| You can have premature generalization as well as premature optimization. – Bjarne Stroustrup | ||
|
| ← Convoluted Regular Expression of the Day | Markup Languages: Theory and Practice → |

Simon Willison (http://simon.incutio.com/) wrote:
Keith (http://www.keithdevens.com/) wrote:
Yep, Perl didn't get OO until version 5 I think. Or nested data structures, for that matter
It'll be real nice in version 6 though.
George Schlossnagle wrote:
The real reason for the long form is to do:
package Classname;
sub new{
my $self = shift;
my $class = ref($self) || $self;
$self = {}; # or whatever you want it to be
return bless $self, $class;
}
This way you can use new not only a a class method, but as a copy constructor as well.
M. Bean wrote:
I'm waiting for Perl 6 before I go back to even considering any further Perl development.
Keith (http://www.keithdevens.com/) wrote:
Besides simple scripts, I'm with you.
Mean Dean (http://www.healyourchurchwebsite.com) wrote:
Actually, I've done some pretty gnarly things with PERL. Not like you can't shoot your foot clean off. But I don't go anywhere without having a copy installed. No like, the ActiveState Perl on one's PC is a very nice way to get small to medium jobs done ... whether it is slicing-n-dicing data, or getting content out on the Net.
Sterling Hughes (http://www.edwardbear.org/blog) wrote:
Could be shortened to ::
package Classname;
sub new { bless {} }
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):
Generated in about 0.241s.
(Used 8 db queries)

It's still double-dutch to me. I never got the hang of OOP in Perl - I know it's really powerful, but the syntax is just ridiculously obscure. It's painfully obvious that OOP was "tacked on" to the language some time after the initial syntax was designed.