This constructor is written in a confusing way, so you're right to be confused about it. About your questions:
Whether or how that can make sense has been discussed here and elsewhere. In most cases, you can just leave it out.my $obj = My::Class->new(...); my $other_obj = $obj->new(...);
My::Class->new("a","b");
is the same as
My::Class::new("My::Class","a","b");
except that inheritance is not respected in the second case.
$self = { @_ }; # or %$self = @_;
In short, the whole constructor could have been written as:
sub new { my ($class,%args) = @_; my $self = \%args; bless $self, ref($class)||$class; };
In reply to Re: confusing constructor code
by Corion
in thread confusing constructor code
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |