Use XML::SAX::ExpatXS if available
This commit is contained in:
parent
3c8ac435ad
commit
304676b6aa
2
Build.PL
2
Build.PL
@ -26,7 +26,7 @@ my $build = Module::Build->new(
|
||||
recommends => {
|
||||
'Growl::GNTP' => '0.15',
|
||||
'Net::DBus' => '0',
|
||||
'XML::SAX' => '0',
|
||||
'XML::SAX::ExpatXS' => '0',
|
||||
'Wx' => '0.9901',
|
||||
},
|
||||
script_files => ['slic3r.pl'],
|
||||
|
@ -7,14 +7,17 @@ sub read_file {
|
||||
my $self = shift;
|
||||
my ($file) = @_;
|
||||
|
||||
eval "require Slic3r::Format::AMF::Parser; 1"
|
||||
or die "AMF parsing requires XML::SAX\n";
|
||||
eval qq{
|
||||
require Slic3r::Format::AMF::Parser;
|
||||
use XML::SAX::ParserFactory;
|
||||
1;
|
||||
} or die "AMF parsing requires XML::SAX\n";
|
||||
|
||||
open my $fh, '<', $file or die "Failed to open $file\n";
|
||||
|
||||
my $model = Slic3r::Model->new;
|
||||
XML::SAX::PurePerl
|
||||
->new(Handler => Slic3r::Format::AMF::Parser->new(_model => $model))
|
||||
XML::SAX::ParserFactory
|
||||
->parser(Handler => Slic3r::Format::AMF::Parser->new(_model => $model))
|
||||
->parse_file($fh);
|
||||
close $fh;
|
||||
|
||||
|
@ -2,8 +2,6 @@ package Slic3r::Format::AMF::Parser;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use XML::SAX::PurePerl;
|
||||
|
||||
use base 'XML::SAX::Base';
|
||||
|
||||
my %xyz_index = (x => 0, y => 1, z => 2); #=
|
||||
|
Loading…
Reference in New Issue
Block a user