mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-08 22:35:15 -06:00
Use XML::SAX::ExpatXS if available
This commit is contained in:
parent
3c8ac435ad
commit
304676b6aa
3 changed files with 8 additions and 7 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue