{"id":822,"date":"2004-04-28T15:20:49","date_gmt":"2004-04-28T15:20:49","guid":{"rendered":"http:\/\/beta.robertprice.co.uk\/robblog\/2004\/04\/rdf_simple_and_proxies-shtml\/"},"modified":"2004-04-28T15:20:49","modified_gmt":"2004-04-28T15:20:49","slug":"rdf_simple_and_proxies-shtml","status":"publish","type":"post","link":"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/","title":{"rendered":"RDF::Simple And Proxies"},"content":{"rendered":"<p>\nI was trying to work with <a href=\"http:\/\/www.zooleika.org.uk\/\">Jo Walsh<\/a>&#8216;s <a href=\"http:\/\/search.cpan.org\/~zooleika\/RDF-Simple-0.12\/lib\/RDF\/Simple.pm\">RDF::Simple<\/a> 0.12 <a href=\"http:\/\/www.perl.com\/\">Perl<\/a> module, but it kept failing as it wasn&#8217;t able to connect past the office proxy server.\n<\/p>\n<p>\nIt turned out the solution wasn&#8217;t too hard. I tweaked the <a href=\"http:\/\/search.cpan.org\/~zooleika\/RDF-Simple-0.12\/lib\/RDF\/Simple\/Parser.pm\">RDF::Simple::Parser<\/a> to accept an <code>http_proxy<\/code> parameter in its <code>new<\/code> method. The <code>ua<\/code> method then checks this when it creates a <a href=\"http:\/\/search.cpan.org\/~gaas\/libwww-perl-5.79\/lib\/LWP\/UserAgent.pm\">LWP::UserAgent<\/a> object, and either sets the proxy method directly, or uses the settings from environment variables.\n<\/p>\n<p>\nThe following patch has already been emailed to Jo for her to consider inclusion in the next module release, but in the mean time it is available here.\n<\/p>\n<div class=\"code\"><code><br \/>\n--- Parser.pm\tWed Apr 28 11:20:00 2004<br \/>\n+++ Parser.pm.robsnew\tWed Apr 28 11:19:52 2004<br \/>\n@@ -4,9 +4,9 @@<br \/>\nuse XML::SAX qw(Namespaces Validation);<br \/>\nuse LWP::UserAgent;<br \/>\n-our $VERSION = '0.1';<br \/>\n+our $VERSION = '0.2';<br \/>\n-use Class::MethodMaker new_hash_init => 'new', get_set => [ qw(base)];<br \/>\n+use Class::MethodMaker new_hash_init => 'new', get_set => [ qw(base http_proxy)];<br \/>\nsub parse_rdf {<br \/>\nmy ($self,$rdf) = @_;<br \/>\n@@ -36,7 +36,15 @@<br \/>\nsub ua {<br \/>\nmy $self = shift;<br \/>\n-    $self->{_ua} ||= LWP::UserAgent->new(timeout => 30);<br \/>\n+    unless ($self->{_ua}) {<br \/>\n+        $self->{_ua} = LWP::UserAgent->new(timeout => 30);<br \/>\n+        if ($self->http_proxy) {<br \/>\n+            $self->{_ua}->proxy('http',$self->http_proxy);<br \/>\n+        } else {<br \/>\n+            $self->{_ua}->env_proxy;<br \/>\n+        }<br \/>\n+    }<br \/>\n+    return $self->{_ua};<br \/>\n}<br \/>\npackage RDF::Simple::Parser::Handler;<br \/>\n@@ -481,6 +489,11 @@<br \/>\n'base' supplies a base URI<br \/>\nfor relative URIs found in the document<br \/>\n+<br \/>\n+    'http_proxy' optionally supplies<br \/>\n+    the address of an http proxy server.<br \/>\n+    If this is not given it will try to use<br \/>\n+    the default environment settings.<br \/>\n=head2 parse_rdf($rdf)<br \/>\n<\/code><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I was trying to work with Jo Walsh&#8216;s RDF::Simple 0.12 Perl module, but it kept failing as it wasn&#8217;t able to connect past the office proxy server. It turned out the solution wasn&#8217;t too hard. I tweaked the RDF::Simple::Parser to accept an http_proxy parameter in its new method. The ua method then checks this when &hellip; <a href=\"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;RDF::Simple And Proxies&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-822","post","type-post","status-publish","format-standard","hentry","category-dev"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>RDF::Simple And Proxies - Robert Price<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RDF::Simple And Proxies - Robert Price\" \/>\n<meta property=\"og:description\" content=\"I was trying to work with Jo Walsh&#8216;s RDF::Simple 0.12 Perl module, but it kept failing as it wasn&#8217;t able to connect past the office proxy server. It turned out the solution wasn&#8217;t too hard. I tweaked the RDF::Simple::Parser to accept an http_proxy parameter in its new method. The ua method then checks this when &hellip; Continue reading &quot;RDF::Simple And Proxies&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/\" \/>\n<meta property=\"og:site_name\" content=\"Robert Price\" \/>\n<meta property=\"article:published_time\" content=\"2004-04-28T15:20:49+00:00\" \/>\n<meta name=\"author\" content=\"rob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rob\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rdf_simple_and_proxies-shtml\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rdf_simple_and_proxies-shtml\\\/\"},\"author\":{\"name\":\"rob\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"headline\":\"RDF::Simple And Proxies\",\"datePublished\":\"2004-04-28T15:20:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rdf_simple_and_proxies-shtml\\\/\"},\"wordCount\":109,\"articleSection\":[\"Dev\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rdf_simple_and_proxies-shtml\\\/\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rdf_simple_and_proxies-shtml\\\/\",\"name\":\"RDF::Simple And Proxies - Robert Price\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\"},\"datePublished\":\"2004-04-28T15:20:49+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rdf_simple_and_proxies-shtml\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rdf_simple_and_proxies-shtml\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rdf_simple_and_proxies-shtml\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RDF::Simple And Proxies\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\",\"name\":\"Robert Price\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\",\"name\":\"rob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"caption\":\"rob\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RDF::Simple And Proxies - Robert Price","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/","og_locale":"en_GB","og_type":"article","og_title":"RDF::Simple And Proxies - Robert Price","og_description":"I was trying to work with Jo Walsh&#8216;s RDF::Simple 0.12 Perl module, but it kept failing as it wasn&#8217;t able to connect past the office proxy server. It turned out the solution wasn&#8217;t too hard. I tweaked the RDF::Simple::Parser to accept an http_proxy parameter in its new method. The ua method then checks this when &hellip; Continue reading \"RDF::Simple And Proxies\"","og_url":"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/","og_site_name":"Robert Price","article_published_time":"2004-04-28T15:20:49+00:00","author":"rob","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rob","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/#article","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/"},"author":{"name":"rob","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"headline":"RDF::Simple And Proxies","datePublished":"2004-04-28T15:20:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/"},"wordCount":109,"articleSection":["Dev"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/","url":"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/","name":"RDF::Simple And Proxies - Robert Price","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website"},"datePublished":"2004-04-28T15:20:49+00:00","author":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"breadcrumb":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.robertprice.co.uk\/robblog\/rdf_simple_and_proxies-shtml\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.robertprice.co.uk\/robblog\/"},{"@type":"ListItem","position":2,"name":"RDF::Simple And Proxies"}]},{"@type":"WebSite","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website","url":"https:\/\/www.robertprice.co.uk\/robblog\/","name":"Robert Price","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.robertprice.co.uk\/robblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5","name":"rob","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","caption":"rob"}}]}},"_links":{"self":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/comments?post=822"}],"version-history":[{"count":0,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/822\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/media?parent=822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/categories?post=822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/tags?post=822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}