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