Re: Magic for object constructor wanted



Koszalek Opalek wrote:
My code creates new objects and then populates them with
data, like this:

my $joe = Dude->new();
my $tom = Dude->new();
my $ann = Dude->new();
my $jane = Dude->new();

I suggest that it's probably better to work like this:

my @people = (
Dude->new("joe"),
Dude->new("tom"),
Dude->new("ann").
Dude->new("jane")
);

Alternatively/additioanaly, you might have a "group"
class (set of Dudes) that allow Dudes t be found by name.

If your set of names becomes large, declaring all the
variables implied by your original approach becomes ugly.

BugBear
.