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,23 +1,23 @@
package Slic3r::Polyline;
use Moose;
use Moo;
has 'lines' => (
traits => ['Array'],
is => 'rw',
isa => 'ArrayRef[Slic3r::Line]',
#isa => 'ArrayRef[Slic3r::Line]',
default => sub { [] },
handles => {
add_line => 'push',
},
);
after 'add_line' => sub {
sub add_line {
my $self = shift;
my ($line) = @_;
push @{ $self->lines }, $line;
# add a weak reference to this polyline in line objects
# (avoid circular refs)
$self->lines->[-1]->polyline($self);
};
}
sub BUILD {
my $self = shift;