if($res->is_success){ $result->{'url'} = $res->request->uri; $result->{'charset'} = _suggest_charset($res); $result->{'content'} = $res->decoded_content(charset => $result->{'charset'}); return $result; }else{ ..... }