The constructor for the HASH based objects has the equivalent code:
sub new {
my $class = shift;
return bless { @_ }, ref($class)||$class;
}
I suggest that for the ARRAY based objects you take a similar approach:
sub new {
my $class = shift;
return bless [ @_ ], ref($class)||$class;
}
It may not satisfy everyone, but it is consistent between both object
types and will improve the performance for the very simple cases.
For the more complex cases, or where this strategy does not fit the
project, the user can just hand-code his own constructor.
Thanks,
Paulo