my $response = $robot->get($url, $url); if ($response->is_success and $response->content_type eq 'application/pdf'){ print PDF $contents; }