diff options
Diffstat (limited to 'perllib/Open311/GetUpdates.pm')
-rw-r--r-- | perllib/Open311/GetUpdates.pm | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/perllib/Open311/GetUpdates.pm b/perllib/Open311/GetUpdates.pm index 901e78809..1b1e339e3 100644 --- a/perllib/Open311/GetUpdates.pm +++ b/perllib/Open311/GetUpdates.pm @@ -42,23 +42,12 @@ sub update_reports { my ( $self, $report_ids, $open311, $body ) = @_; my $service_requests = $open311->get_service_requests( $report_ids ); - - my $requests; - - # XML::Simple is a bit inconsistent in how it structures - # things depending on the number of children an element has :( - if ( ref $service_requests->{request} eq 'ARRAY' ) { - $requests = $service_requests->{request}; - } - else { - $requests = [ $service_requests->{request} ]; - } + my $requests = $service_requests->{request}; for my $request (@$requests) { - # if it's a ref that means it's an empty element - # however, if there's no updated date then we can't - # tell if it's newer that what we have so we should skip it - next if ref $request->{updated_datetime} || ! exists $request->{updated_datetime}; + # if there's no updated date then we can't + # tell if it's newer than what we have so we should skip it + next unless $request->{updated_datetime}; my $request_id = $request->{service_request_id}; |