Commits

Toby Inkster committed dc905b6

Add HTML version of pod.

Comments (0)

Files changed (1)

lib/HTTP/Link/Parser.html

+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>HTTP::Link::Parser - Perl extension for parsing HTTP Link headers</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+
+<!-- INDEX BEGIN -->
+<div name="index">
+<p><a name="__index__"></a></p>
+
+<ul>
+
+	<li><a href="#name">NAME</a></li>
+	<li><a href="#synopsis">SYNOPSIS</a></li>
+	<li><a href="#description">DESCRIPTION</a></li>
+	<li><a href="#bugs">BUGS</a></li>
+	<li><a href="#see_also">SEE ALSO</a></li>
+	<li><a href="#author">AUTHOR</a></li>
+	<li><a href="#copyright_and_license">COPYRIGHT AND LICENSE</a></li>
+</ul>
+
+<hr name="index" />
+</div>
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>HTTP::Link::Parser - Perl extension for parsing HTTP Link headers</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<pre>
+  use HTTP::Link::Parser qw(:standard);
+  use LWP::UserAgent;
+  
+  my $ua = LWP::UserAgent-&gt;new;
+  my $response = $ua-&gt;get(&quot;<a href="http://example.com/foo&quot">http://example.com/foo&quot</a>;);
+  
+  # Link headers can be parsed into an arrayref of hashrefs.
+  my $links = parse_links_to_list($response);
+  foreach my $link (@$links)
+  {
+     printf(&quot;Link to &lt;%s&gt; with rel=\&quot;%s\&quot;.\n&quot;,
+        $link-&gt;{URI},
+        join ' ', @{ $link-&gt;{'rel'} }
+        );
+  }
+  
+  # Or into a subject -&gt; predicate -&gt; arrayref-of-objects structure
+  my $rdf = parse_links_to_rdf($response);
+  printf(&quot;The next page is &lt;%s&gt;\n&quot;,
+     $rdf-&gt;{'<a href="http://example.com/foo">http://example.com/foo</a>'}                        #s
+         -&gt;{'<a href="http://www.iana.org/assignments/relation/next">http://www.iana.org/assignments/relation/next</a>'} #p
+         -&gt;[0]-&gt;{'value'}                                    #o
+     );</pre>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>HTTP::Link::Parser parses HTTP &quot;Link&quot; headers found in an
+HTTP::Response object. Headers should conform to the format
+described in the forthcoming IETF specification.</p>
+<dl>
+<dt><strong><a name="parse_links_to_list" class="item">$list = <code>parse_links_to_list($response)</code>;</a></strong>
+
+<dd>
+<p><code>$list</code> is an arrayref of hashrefs. Each hashref contains keys
+corresponding to the link parameters of the link, and a key called
+'URI' corresponding to the target of the link.</p>
+</dd>
+<dd>
+<p>The 'rel' and 'rev' keys are arrayrefs containing lists of
+relationships. If the Link used the short form of a registered
+relationship, then the short form is present on this list. Short
+forms can be converted to long forms (URIs) using the
+<a href="#relationship_uri"><code>HTTP::Link::Parser::relationship_uri()</code></a> function.</p>
+</dd>
+</li>
+<dt><strong><a name="parse_links_to_rdf" class="item">$rdf = <code>parse_links_to_rdf($response)</code>;</a></strong>
+
+<dd>
+<p><code>$rdf</code> is a hashref with a structure inspired by the RDF/JSON
+specification. Short forms of relationships are returned in long
+form (as predicate URIs). Dublin Core is used to encode 'hreflang',
+'title' and 'type' link parameters.</p>
+</dd>
+</li>
+<dt><strong><a name="relationship_uri" class="item">$long = HTTP::Link::Parser::relationship_uri($short);</a></strong>
+
+<dd>
+<p>This function is not exported by default. It may be used to convert
+short strings identifying relationships, such as &quot;next&quot; and &quot;prev&quot;,
+into longer URIs identifying the same relationships, such as
+&quot;http://www.iana.org/assignments/relation/next&quot; and
+&quot;http://www.iana.org/assignments/relation/prev&quot;.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="bugs">BUGS</a></h1>
+<p>Does not (yet) support the &quot;title*&quot; (internationalised title)
+link parameter.</p>
+<p>
+</p>
+<hr />
+<h1><a name="see_also">SEE ALSO</a></h1>
+<p><a href="http://www.mnot.net/drafts/draft-nottingham-http-link-header-07.txt">http://www.mnot.net/drafts/draft-nottingham-http-link-header-07.txt</a></p>
+<p><a href="http://n2.talis.com/wiki/RDF_JSON_Specification">http://n2.talis.com/wiki/RDF_JSON_Specification</a></p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Toby Inkster, &lt;<a href="mailto:mail@tobyinkster.co.uk">mail@tobyinkster.co.uk</a>&gt;</p>
+<p>
+</p>
+<hr />
+<h1><a name="copyright_and_license">COPYRIGHT AND LICENSE</a></h1>
+<p>Copyright (C) 2009 by Toby Inkster</p>
+<p>Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the &quot;Software&quot;), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:</p>
+<p>The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.</p>
+<p>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.</p>
+
+</body>
+
+</html>