diff --git a/Build.PL b/Build.PL index c25063c21..1218f3684 100644 --- a/Build.PL +++ b/Build.PL @@ -16,6 +16,7 @@ my $build = Module::Build->new( 'Math::PlanePath' => '53', 'Moo' => '0', 'perl' => '5.10.0', + 'Scalar::Util' => '0', 'Time::HiRes' => '0', }, build_requires => { diff --git a/lib/Slic3r/Polyline.pm b/lib/Slic3r/Polyline.pm index a6cb91af8..32cdb4982 100644 --- a/lib/Slic3r/Polyline.pm +++ b/lib/Slic3r/Polyline.pm @@ -3,6 +3,7 @@ use strict; use warnings; use Math::Clipper qw(); +use Scalar::Util qw(reftype); use Slic3r::Geometry qw(A B polyline_remove_parallel_continuous_edges polyline_remove_acute_vertices move_points same_point); @@ -30,6 +31,7 @@ sub serialize { sub deserialize { my $self = shift; + return $self if reftype $self ne 'SCALAR'; my @v = unpack '(l2)*', $$self; my $o = [ map [ $v[2*$_], $v[2*$_+1] ], 0 .. int($#v/2) ]; bless $_, 'Slic3r::Point' for @$o;