The short answer is that new returns a newly blessed object by convention. You could as easily write something that doesn't always return a new object. Consider:
package Singleton; ... my $singleton = undef; sub new { my $pkg = shift; $singleton ||= bless {}, $pkg; } ... my $frob = new Singleton();
In reply to Re: new() is just a constructor by convention right?
by dws
in thread new() is just a constructor by convention right?
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |