Code optimization

This commit is contained in:
Alessandro Ranellucci 2012-02-25 22:15:34 +01:00
parent 170d29a789
commit c98f6734c7
5 changed files with 13 additions and 20 deletions

View file

@ -7,15 +7,7 @@ use Slic3r::Geometry qw(A B X Y);
sub new {
my $class = shift;
my $self;
if (@_ == 2) {
$self = [ @_ ];
} elsif (ref $_[0] eq 'ARRAY') {
$self = [ $_[0][0], $_[0][1] ];
} elsif ($_[0]->isa(__PACKAGE__)) {
return $_[0];
} else {
die "Invalid argument for $class->new";
}
$self = [ @_ ];
bless $self, $class;
bless $_, 'Slic3r::Point' for @$self;
return $self;