Replaced Moose with Moo => big performance boost and easier packaging

This commit is contained in:
Alessandro Ranellucci 2011-09-06 11:50:43 +02:00
parent bf5824781d
commit 26b05ab155
13 changed files with 67 additions and 75 deletions

View file

@ -1,28 +1,24 @@
package Slic3r::Point;
use Moose;
use Moose::Util::TypeConstraints;
subtype 'Slic3r::Point::Coordinate', as 'Int';
coerce 'Slic3r::Point::Coordinate', from 'Num', via { sprintf '%.0f', $_ };
use Moo;
has 'x' => (
is => 'ro',
isa => 'Slic3r::Point::Coordinate',
#isa => 'Slic3r::Point::Coordinate',
required => 1,
coerce => 1,
coerce => sub { sprintf '%.0f', $_[0] },
);
has 'y' => (
is => 'ro',
isa => 'Slic3r::Point::Coordinate',
#isa => 'Slic3r::Point::Coordinate',
required => 1,
coerce => 1,
coerce => sub { sprintf '%.0f', $_[0] },
);
# this array contains weak references, so it can contain undef's as well
has 'lines' => (
is => 'rw',
isa => 'ArrayRef[Slic3r::Line]',
#isa => 'ArrayRef[Slic3r::Line]',
default => sub { [] },
);