Use XML::SAX::ExpatXS if available

This commit is contained in:
Alessandro Ranellucci 2012-10-24 20:36:32 +02:00
parent 3c8ac435ad
commit 304676b6aa
3 changed files with 8 additions and 7 deletions

View File

@ -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'],

View File

@ -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;

View File

@ -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); #=