Skip to content

Commit e43f35b

Browse files
committed
Substitute XML::Simple for XML::Hash::XS in code
1 parent b0184ff commit e43f35b

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

lib/Paws/Net/RestXMLResponse.pm

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package Paws::Net::RestXMLResponse;
22
use Moose;
3-
use XML::Simple qw//;
3+
use XML::Hash::XS qw//;
44
use Carp qw(croak);
55
use HTTP::Status;
66
use Paws::Exception;
@@ -10,12 +10,10 @@ package Paws::Net::RestXMLResponse;
1010

1111
return {} if (not defined $data or $data eq '');
1212

13-
my $xml = XML::Simple->new(
14-
ForceArray => qr/^(?:item|Errors)/i,
15-
KeyAttr => '',
16-
SuppressEmpty => undef,
13+
my $xml = XML::Hash::XS->new(
14+
force_array => qr/^(?:item|Errors)/i,
1715
);
18-
return $xml->parse_string($data);
16+
return $xml->xml2hash($data);
1917
}
2018

2119
sub process {

lib/Paws/Net/XMLResponse.pm

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
package Paws::Net::XMLResponse;
22
use Moose;
3-
use XML::Simple qw//;
3+
use XML::Hash::XS qw//;
4+
45
use Carp qw(croak);
56
use Paws::Exception;
6-
77
has _xml_parser => (
88
is => 'ro',
99
default => sub {
10-
return XML::Simple->new(
11-
ForceArray => qr/^(?:item|Errors)/i,
12-
KeyAttr => '',
13-
SuppressEmpty => undef,
10+
return XML::Hash::XS->new(
11+
force_array => qr/^(?:item|Errors)/i,
1412
);
1513
}
1614
);
@@ -27,7 +25,7 @@ package Paws::Net::XMLResponse;
2725
);
2826
}
2927

30-
my $struct = eval { $self->_xml_parser->parse_string($response->content) };
28+
my $struct = eval { $self->_xml_parser->xml2hash($response->content) };
3129
if ($@){
3230
return Paws::Exception->throw(
3331
message => $@,

0 commit comments

Comments
 (0)