Skip to content

Commit 57e3ea3

Browse files
committed
Ensure parameters to "each" is a hash in TO_JSON and from_hash
1 parent 0f75b05 commit 57e3ea3

File tree

1 file changed

+2
-2
lines changed
  • samples/client/petstore/perl/lib/WWW/SwaggerClient/Object

1 file changed

+2
-2
lines changed

samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/BaseObject.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ sub to_hash {
2828
sub TO_JSON {
2929
my $self = shift;
3030
my $_data = {};
31-
foreach my $_key (keys $self->get_attribute_map) {
31+
foreach my $_key (keys %{$self->get_attribute_map}) {
3232
if (defined $self->{$_key}) {
3333
$_data->{$self->get_attribute_map->{$_key}} = $self->{$_key};
3434
}
@@ -40,7 +40,7 @@ sub TO_JSON {
4040
sub from_hash {
4141
my ($self, $hash) = @_;
4242
# loop through attributes and use swagger_types to deserialize the data
43-
while ( my ($_key, $_type) = each $self->get_swagger_types ) {
43+
while ( my ($_key, $_type) = each %{$self->get_swagger_types} ) {
4444
if ($_type =~ /^array\[/i) { # array
4545
my $_subclass = substr($_type, 6, -1);
4646
my @_array = ();

0 commit comments

Comments
 (0)