From: Martin F. <ma...@ne...> - 2007-10-12 20:37:17
|
Hi Philip, Thanks for this. I think the Java and Ruby libraries have been getting more attention so we must have missed these issues. I've prepared a new tarball labeled 0.1.1 which will go up on Sourceforge soon. Martin Philip Bett wrote: > Hi all, > I've had to make a couple of modifications to my copy of Connotea.pm in > www-connotea-perl-0.1 in order to get it to work -- I thought I'd post > them here in case others found them useful. (apologies if they're known > issues, but they are still in the downloadable code) > > > (1) Using a proxy: > Working from a university means all web traffic has to go via a proxy > server. > > I had to add a line to the sub 'new' in Connotea.pm: > ... > $ua = LWP::UserAgent->new; ## Existing line... > $ua->env_proxy; ## New line! > $ua->agent(UA_PREFIX.' ('.$ua->agent.')'); ## Existing line... > ... > > Simple enough. > > > (2) Parsing the response: > This is a bit more serious. The sub 'parse_body' is set to croak if the > returned content-type isn't on a list of allowed values. This list > includes "application/xml", but the actual response gives a content-type > of "application/xml; charset=UTF-8", so it will always croak. > > My solution is to split the returned string at the first semicolon, and > just take the first chunk: > > @conttypes = split( /([;])/, $response->header('Content-type'), ); > $conttype = $conttypes[0]; > croak "Invalid content type in response: $conttype\n" unless > $rdf_content_types{$conttype}; > > (original line was: > croak 'Invalid content type in response: > "'.$response->header('Content-type').'"' unless > $rdf_content_types{$response->header('Content-type')}; > ) > > > These solutions are, I'm sure, not the most efficient, elegant or > robust, but that's about the limit of my perl skills at the moment! I'd > like to hear how these could be improved, or if anyone knows of any > similar pitfalls I might encounter. > > > Cheers, > Phil Bett > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Connotea-code-devel mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/connotea-code-devel |