Toby Inkster avatar Toby Inkster committed a4c64b4

Release HTTP::Link::Parser 0.05.
Release HTML::HTML5::Microdata::ToRDFa 0.02.
Update backpan links in all Changes.ttl files to point to working mirror.

Comments (0)

Files changed (12)

-Revision history for Perl extension HTTP::Link::Parser.
+############################################################################
+## Changes #################################################################
+############################################################################
 
-0.01  Fri Oct  9 13:23:07 2009
-	- original version; created by h2xs 1.23 with options
-		-X HTTP::Link::Parser
+HTTP-Link-Parser
+================
 
-0.02
-	- bugfixes
+Created:      2009-10-09
+Home page:    <http://search.cpan.org/dist/HTTP-Link-Parser/>
+Bug tracker:  <http://rt.cpan.org/Dist/Display.html?Queue=HTTP-Link-Parser>
+Maintainer:   Toby Inkster <mailto:tobyink@cpan.org>
 
-0.03
-	- Provide an RDF::Trine::Model
+0.05 [2010-02-07]
+ - (Update) Copyright 2010.
+ - General documentation improvements.
+ - (Update) Use my new build system.
+ - Clean up @EXPORT and @EXPORT_OK.
+ - Rename parse_header to parse_single_link, and document this.
 
-0.04
-	- Support for "title*" parameter.
+0.04 [2009-12-15]
+ - (Addition) Support the 'title*' parameter.
 
+0.03 [2009-11-28]
+ - (Addition) Provide an RDF::Trine::Model
+
+0.02 [2009-11-24]
+
+0.01 [2009-10-09] # First release
+
+#############################################################
+
+@prefix :        <http://usefulinc.com/ns/doap#> .
+@prefix dcs:     <http://ontologi.es/doap-changeset#> .
+@prefix dc:      <http://purl.org/dc/terms/> .
+@prefix foaf:    <http://xmlns.com/foaf/0.1/> .
+@prefix my:      <http://search.cpan.org/dist/HTTP-Link-Parser/#> .
+@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix toby:    <http://tobyinkster.co.uk/#> .
+@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
+
+#############################################################
+
+<>
+
+	dc:title         "Changes" ;
+	dc:description   "Revision history for Perl extension HTTP::Link::Parser."@en ;
+	dc:subject       my:project ;
+	dc:creator       toby:i .
+
+#############################################################
+
+my:v_0_01
+
+	a               :Version ;
+	dc:issued       "2009-10-09"^^xsd:date ;
+	:revision       "0.01"^^xsd:string ;
+	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/HTTP-Link-Parser-0.01.tar.gz> ;
+	rdfs:label      "First release"@en .
+
+my:v_0_02
+
+	a               :Version ;
+	dc:issued       "2009-11-24"^^xsd:date ;
+	:revision       "0.02"^^xsd:string ;
+	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/HTTP-Link-Parser-0.02.tar.gz> ;
+	dcs:changeset [
+		dcs:versus my:v_0_01 ;
+		rdfs:comment "Bugfixes" 
+		] .
+
+my:v_0_03
+
+	a               :Version ;
+	dc:issued       "2009-11-28"^^xsd:date ;
+	:revision       "0.03"^^xsd:string ;
+	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/HTTP-Link-Parser-0.03.tar.gz> ;
+	dcs:changeset [
+		dcs:versus my:v_0_02 ;
+		dcs:item
+			[ rdfs:label "Provide an RDF::Trine::Model"@en ; a dcs:Addition ] 
+		] .
+
+my:v_0_04
+
+	a               :Version ;
+	dc:issued       "2009-12-15"^^xsd:date ;
+	:revision       "0.04"^^xsd:string ;
+	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/HTTP-Link-Parser-0.04.tar.gz> ;
+	dcs:changeset [
+		dcs:versus my:v_0_03 ;
+		dcs:item
+			[ rdfs:label "Support the 'title*' parameter."@en ; a dcs:Addition ] 
+		] .
+
+my:v_0_05
+
+	a               :Version ;
+	dc:issued       "2010-02-07"^^xsd:date ;
+	:revision       "0.05"^^xsd:string ;
+	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/HTTP-Link-Parser-0.05.tar.gz> ;
+	dcs:changeset [
+		dcs:versus my:v_0_04 ;
+		dcs:item
+			[ rdfs:label "Rename parse_header to parse_single_link, and document this."@en ] ,
+			[ rdfs:label "Clean up @EXPORT and @EXPORT_OK."@en ] ,
+			[ rdfs:label "Copyright 2010."@en ; a dcs:Update ] ,
+			[ rdfs:label "Use my new build system."@en ; a dcs:Update ] ,
+			[ rdfs:label "General documentation improvements."@en ] 
+		] .
+
+#############################################################
+
+my:project
+
+	a               :Project ;
+	:name           "HTTP-Link-Parser" ;
+	:shortdesc      "parse HTTP Link headers"@en ;
+	:programming-language  "Perl" ;
+	:homepage       <http://search.cpan.org/dist/HTTP-Link-Parser/> ;
+	:download-page  <http://search.cpan.org/dist/HTTP-Link-Parser/> ;
+	:bug-database   <http://rt.cpan.org/Dist/Display.html?Queue=HTTP-Link-Parser> ;
+	:repository     [ a :SVNRepository ; :browse <http://goddamn.co.uk/viewvc/perlmods/HTTP-Link-Parser/> ] ;
+	:maintainer     toby:i ;
+	:developer      toby:i ;
+	:documenter     toby:i ;
+	:tester         toby:i ;
+	:created        "2009-10-09"^^xsd:date ;
+	:license        <http://www.opensource.org/licenses/mit-license.php> ;
+	:release        my:v_0_01 , my:v_0_02 , my:v_0_03 , my:v_0_04 , my:v_0_05 .
+
+#############################################################
+
+toby:i
+
+	a               foaf:Person ;
+	foaf:name       "Toby Inkster" ;
+	foaf:homepage   <http://tobyinkster.co.uk/> ;
+	foaf:page       <http://search.cpan.org/~tobyink/> ;
+	foaf:mbox       <mailto:tobyink@cpan.org> .
+
+#############################################################
+<?xml version="1.0" encoding="utf-8"?>
+<rdf:RDF
+   xmlns:dc="http://purl.org/dc/terms/"
+   xmlns:dcs="http://ontologi.es/doap-changeset#"
+   xmlns:foaf="http://xmlns.com/foaf/0.1/"
+   xmlns:my="http://search.cpan.org/dist/HTTP-Link-Parser/#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+   xmlns:toby="http://tobyinkster.co.uk/#"
+   xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+   xmlns="http://usefulinc.com/ns/doap#">
+  <rdf:Description rdf:about="file:///home/tai/src/perlmods/HTTP-Link-Parser/Changes.ttl">
+    <dc:creator rdf:resource="http://tobyinkster.co.uk/#i"/>
+    <dc:description xml:lang="en">Revision history for Perl extension HTTP::Link::Parser.</dc:description>
+    <dc:subject rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/#project"/>
+    <dc:title>Changes</dc:title>
+  </rdf:Description>
+  <Version rdf:about="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_01">
+    <dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2009-10-09</dc:issued>
+    <file-release rdf:resource="http://backpan.perl.org/authors/id/T/TO/TOBYINK/HTTP-Link-Parser-0.01.tar.gz"/>
+    <revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.01</revision>
+    <rdfs:label xml:lang="en">First release</rdfs:label>
+  </Version>
+  <Version rdf:about="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_02">
+    <dcs:changeset>
+      <rdf:Description>
+        <dcs:versus rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_01"/>
+        <rdfs:comment>Bugfixes</rdfs:comment>
+      </rdf:Description>
+    </dcs:changeset>
+    <dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2009-11-24</dc:issued>
+    <file-release rdf:resource="http://backpan.perl.org/authors/id/T/TO/TOBYINK/HTTP-Link-Parser-0.02.tar.gz"/>
+    <revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.02</revision>
+  </Version>
+  <Version rdf:about="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_03">
+    <dcs:changeset>
+      <rdf:Description>
+        <dcs:item>
+          <dcs:Addition>
+            <rdfs:label xml:lang="en">Provide an RDF::Trine::Model</rdfs:label>
+          </dcs:Addition>
+        </dcs:item>
+        <dcs:versus rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_02"/>
+      </rdf:Description>
+    </dcs:changeset>
+    <dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2009-11-28</dc:issued>
+    <file-release rdf:resource="http://backpan.perl.org/authors/id/T/TO/TOBYINK/HTTP-Link-Parser-0.03.tar.gz"/>
+    <revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.03</revision>
+  </Version>
+  <Version rdf:about="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_04">
+    <dcs:changeset>
+      <rdf:Description>
+        <dcs:item>
+          <dcs:Addition>
+            <rdfs:label xml:lang="en">Support the 'title*' parameter.</rdfs:label>
+          </dcs:Addition>
+        </dcs:item>
+        <dcs:versus rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_03"/>
+      </rdf:Description>
+    </dcs:changeset>
+    <dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2009-12-15</dc:issued>
+    <file-release rdf:resource="http://backpan.perl.org/authors/id/T/TO/TOBYINK/HTTP-Link-Parser-0.04.tar.gz"/>
+    <revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.04</revision>
+  </Version>
+  <Version rdf:about="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_05">
+    <dcs:changeset>
+      <rdf:Description>
+        <dcs:item>
+          <rdf:Description>
+            <rdfs:label xml:lang="en">General documentation improvements.</rdfs:label>
+          </rdf:Description>
+        </dcs:item>
+        <dcs:item>
+          <rdf:Description>
+            <rdfs:label xml:lang="en">Rename parse_header to parse_single_link, and document this.</rdfs:label>
+          </rdf:Description>
+        </dcs:item>
+        <dcs:item>
+          <rdf:Description>
+            <rdfs:label xml:lang="en">Clean up @EXPORT and @EXPORT_OK.</rdfs:label>
+          </rdf:Description>
+        </dcs:item>
+        <dcs:item>
+          <dcs:Update>
+            <rdfs:label xml:lang="en">Copyright 2010.</rdfs:label>
+          </dcs:Update>
+        </dcs:item>
+        <dcs:item>
+          <dcs:Update>
+            <rdfs:label xml:lang="en">Use my new build system.</rdfs:label>
+          </dcs:Update>
+        </dcs:item>
+        <dcs:versus rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_04"/>
+      </rdf:Description>
+    </dcs:changeset>
+    <dc:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2010-02-07</dc:issued>
+    <file-release rdf:resource="http://backpan.perl.org/authors/id/T/TO/TOBYINK/HTTP-Link-Parser-0.05.tar.gz"/>
+    <revision rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0.05</revision>
+  </Version>
+  <Project rdf:about="http://search.cpan.org/dist/HTTP-Link-Parser/#project">
+    <bug-database rdf:resource="http://rt.cpan.org/Dist/Display.html?Queue=HTTP-Link-Parser"/>
+    <created rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2009-10-09</created>
+    <developer rdf:resource="http://tobyinkster.co.uk/#i"/>
+    <documenter rdf:resource="http://tobyinkster.co.uk/#i"/>
+    <download-page rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/"/>
+    <homepage rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/"/>
+    <license rdf:resource="http://www.opensource.org/licenses/mit-license.php"/>
+    <maintainer rdf:resource="http://tobyinkster.co.uk/#i"/>
+    <name>HTTP-Link-Parser</name>
+    <programming-language>Perl</programming-language>
+    <release rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_01"/>
+    <release rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_02"/>
+    <release rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_03"/>
+    <release rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_04"/>
+    <release rdf:resource="http://search.cpan.org/dist/HTTP-Link-Parser/#v_0_05"/>
+    <repository>
+      <SVNRepository>
+        <browse rdf:resource="http://goddamn.co.uk/viewvc/perlmods/HTTP-Link-Parser/"/>
+      </SVNRepository>
+    </repository>
+    <shortdesc xml:lang="en">parse HTTP Link headers</shortdesc>
+    <tester rdf:resource="http://tobyinkster.co.uk/#i"/>
+  </Project>
+  <foaf:Person rdf:about="http://tobyinkster.co.uk/#i">
+    <foaf:homepage rdf:resource="http://tobyinkster.co.uk/"/>
+    <foaf:mbox rdf:resource="mailto:tobyink@cpan.org"/>
+    <foaf:name>Toby Inkster</foaf:name>
+    <foaf:page rdf:resource="http://search.cpan.org/~tobyink/"/>
+  </foaf:Person>
+</rdf:RDF>
 Changes
+Changes.ttl
+Changes.xml
 Makefile.PL
 MANIFEST
 MANIFEST.SKIP
 lib/HTTP/Link/Parser.pm
 
 t/00sig.t
-t/HTTP-Link-Parser.t
+t/01basic.t
 
 inc/Module/AutoInstall.pm
 inc/Module/Install/AutoInstall.pm
 inc/Module/Install/Base.pm
-inc/Module/Install/Bugtracker.pm
 inc/Module/Install/Can.pm
+inc/Module/Install/DOAPChangeSets.pm
 inc/Module/Install/Fetch.pm
-inc/Module/Install/Homepage.pm
 inc/Module/Install/Include.pm
 inc/Module/Install/Makefile.pm
 inc/Module/Install/Metadata.pm
 inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
 inc/Test/Signature.pm
+
 ---
-abstract: 'Perl extension for parsing HTTP Link headers'
+abstract: 'parse HTTP Link headers'
 author:
   - 'Toby Inkster <tobyink@cpan.org>'
 build_requires:
   URI::Escape: 3.00
   perl: 5.6.0
 resources:
-  bugtracker: http://search.cpan.org/dist/HTTP-Link-Parser/
+  bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=HTTP-Link-Parser
   homepage: http://search.cpan.org/dist/HTTP-Link-Parser/
   license: http://opensource.org/licenses/mit-license.php
-version: 0.04
+  repository: http://goddamn.co.uk/viewvc/perlmods/HTTP-Link-Parser/
+version: 0.05
 
 use inc::Module::Install;
 
+my $dist = 'HTTP-Link-Parser';
+my $fn   = "lib/$dist.pm"; $fn =~ s#-#/#g;
+
+name                $dist;
+perl_version_from   $fn;
+version_from        $fn;
+abstract_from       $fn;
+readme_from         $fn;
+author              'Toby Inkster <tobyink@cpan.org>';
 license             'mit';
 
-name                'HTTP-Link-Parser';
-author              'Toby Inkster <tobyink@cpan.org>';
-perl_version_from   'lib/HTTP/Link/Parser.pm';
-version_from        'lib/HTTP/Link/Parser.pm';
-abstract_from       'lib/HTTP/Link/Parser.pm';
-readme_from         'lib/HTTP/Link/Parser.pm';
-
 test_requires       'Test::More' => '0.61';
 
 requires            'Encode'             => 0;
 requires            'URI'                => '1.30';
 requires            'URI::Escape'        => '3.00';
 
-auto_set_homepage;
-auto_set_bugtracker;
+# install_script 'fingerw';
+
+resources(
+	'homepage'   => "http://search.cpan.org/dist/$dist/",
+	'repository' => "http://goddamn.co.uk/viewvc/perlmods/$dist/",
+	'bugtracker' => "http://rt.cpan.org/Dist/Display.html?Queue=$dist",
+	);
+	
+write_doap_changes;
+write_doap_changes_xml;
 
 include 'Test::Signature';
 auto_install;
 NAME
-    HTTP::Link::Parser - Perl extension for parsing HTTP Link headers
-
-VERSION
-    0.04
+    HTTP::Link::Parser - parse HTTP Link headers
 
 SYNOPSIS
-      use HTTP::Link::Parser qw(:standard);
+      use HTTP::Link::Parser ':standard';
       use LWP::UserAgent;
   
       my $ua = LWP::UserAgent->new;
             $statement->predicate->uri);
       }
 
+VERSION
+    0.05
+
 DESCRIPTION
     HTTP::Link::Parser parses HTTP "Link" headers found in an HTTP::Response
     object. Headers should conform to the format described in the
     forthcoming IETF specification.
 
-    $model = parse_links_into_model($response, [$existing_model]);
-            $model is an RDF::Trine::Model. Dublin Core is used to encode
-            'hreflang', 'title' and 'type' link parameters.
+  Functions
+    To export all functions:
 
-    $rdf = parse_links_to_rdfjson($response);
-            $rdf 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.
+      use HTTP::Link::Parser ':all';
 
-            This can be thought of as a shortcut for:
+    "$model = parse_links_into_model($response, [$existing_model])"
+        Takes an HTTP::Response object (or in fact, any HTTP::Message
+        object) and returns an RDF::Trine::Model containing link data
+        extracted from the response. Dublin Core is used to encode
+        'hreflang', 'title' and 'type' link parameters.
 
-              use RDF::Trine 0.112;
-              $model = parse_links_into_model($response);
-              $rdf   = $model->as_hashref;
+        $existing_model is an RDF::Trine::Model to add data to. If omitted,
+        a new, empty model is created.
 
-            But it's faster as no intermediate model is built.
+    "$data = parse_links_to_rdfjson($response)"
+        $data is a hashref with a structure inspired by the RDF/JSON
+        specification. This can be thought of as a shortcut for:
 
-    $list = parse_links_to_list($response);
-            $list 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.
+          use RDF::Trine 0.112;
+          $model = parse_links_into_model($response);
+          $data  = $model->as_hashref;
 
-            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
-            "HTTP::Link::Parser::relationship_uri()" function.
+        But it's faster as no intermediate model is built.
 
-    $long = HTTP::Link::Parser::relationship_uri($short);
-            This function is not exported by default. It may be used to
-            convert short strings identifying relationships, such as "next"
-            and "prev", into longer URIs identifying the same relationships,
-            such as "http://www.iana.org/assignments/relation/next" and
-            "http://www.iana.org/assignments/relation/prev".
+    "$list = parse_links_to_list($response)"
+        This function is not exported by default.
+
+        $list 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.
+
+        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
+        "relationship_uri" function.
+
+        The structure returned by this function should not be considered
+        stable.
+
+    "$data = parse_single_link($link, $base)"
+        This function is not exported by default.
+
+        This parses a single Link header (minus the "Link:" bit itself) into
+        a hashref structure. A base URI must be included in case the link
+        contains relative URIs.
+
+        The structure returned by this function should not be considered
+        stable.
+
+    "$long = relationship_uri($short)"
+        This function is not exported by default.
+
+        It may be used to convert short strings identifying relationships,
+        such as "next" and "prev", into longer URIs identifying the same
+        relationships, such as
+        "http://www.iana.org/assignments/relation/next" and
+        "http://www.iana.org/assignments/relation/prev".
+
+        If passed a string which is a URI already, simply returns it as-is.
 
 BUGS
     Please report any bugs to <http://rt.cpan.org/>.
 SEE ALSO
     <http://www.mnot.net/drafts/draft-nottingham-http-link-header-07.txt>
 
-    RDF::Trine, HTTP::Response.
+    RDF::Trine, RDF::TrineShortcuts, HTTP::Response.
 
     <http://n2.talis.com/wiki/RDF_JSON_Specification>.
 
 AUTHOR
     Toby Inkster <tobyink@cpan.org>.
 
-COPYRIGHT AND LICENSE
-    Copyright (C) 2009 by Toby Inkster
+COPYRIGHT AND LICENCE
+    Copyright (C) 2009-2010 by Toby Inkster
 
+  a.k.a. "The MIT Licence"
     Permission is hereby granted, free of charge, to any person obtaining a
     copy of this software and associated documentation files (the
     "Software"), to deal in the Software without restriction, including
+use lib "lib";
+use HTTP::Link::Parser ':all';
+
+foreach my $f (qw(parse_links_to_list parse_links_to_rdfjson parse_links_into_model parse_single_link relationship_uri jumpy))
+{
+	eval { print $f, " : ", eval('defined &'.$f.';'), "\n"; };
+}

lib/HTTP/Link/Parser.pm

+=head1 NAME
+
+HTTP::Link::Parser - parse HTTP Link headers
+
+=head1 SYNOPSIS
+
+  use HTTP::Link::Parser ':standard';
+  use LWP::UserAgent;
+  
+  my $ua = LWP::UserAgent->new;
+  my $response = $ua->get("http://example.com/foo");
+  
+  # Parse link headers into an RDF::Trine::Model.
+  my $model = parse_links_into_model($response);
+
+  # Find data about <http://example.com/foo>.
+  my $iterator = $model->get_statements(
+    RDF::Trine::Node::Resource->new('http://example.com/foo'),
+    undef,
+    undef);
+
+  while ($statement = $iterator->next)
+  {
+     # Skip data where the value is not a resource (i.e. link)
+     next unless $statement->object->is_resource;
+
+     printf("Link to <%s> with rel=\"%s\".\n",
+        $statement->object->uri,
+        $statement->predicate->uri);
+  }
+
+=cut
+
 package HTTP::Link::Parser;
 
-use 5.006000;
+use 5.006;
 use strict;
 no warnings;
 
 require Exporter;
 our @ISA = qw(Exporter);
 our %EXPORT_TAGS = (
-	'all' => [ qw(parse_links_to_list parse_links_to_rdfjson parse_links_into_model relationship_uri) ],
-	'standard' => [ qw(parse_links_to_list parse_links_to_rdfjson parse_links_into_model) ]
+	'all'      => [ qw(parse_links_into_model parse_links_to_rdfjson parse_links_to_list parse_single_link relationship_uri) ],
+	'standard' => [ qw(parse_links_into_model parse_links_to_rdfjson) ]
 	);
 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
-our @EXPORT    = ( );
+our @EXPORT    = ( @{ $EXPORT_TAGS{'standard'} } );
 
-our $VERSION = '0.04';
+=head1 VERSION
+
+0.05
+
+=cut
+
+our $VERSION = '0.05';
 
 use Encode qw(decode encode_utf8);
 use RDF::Trine 0.112;
 use URI;
 use URI::Escape;
 
-sub relationship_uri
-{
-	my $str = shift;
+=head1 DESCRIPTION
 
-	if ($str =~ /^([a-z][a-z0-9\+\.\-]*)\:/i)
-	{
-		# seems to be an absolute URI, so can safely return "as is".
-		return $str;
-	}
+HTTP::Link::Parser parses HTTP "Link" headers found in an
+HTTP::Response object. Headers should conform to the format
+described in the forthcoming IETF specification.
 
-	return 'http://www.iana.org/assignments/relation/' . (lc $str);
+=head2 Functions
 
-	my $url = url (lc $str), 'http://www.iana.org/assignments/relation/';
-	return $url->abs->as_string;
+To export all functions:
 
-	return undef;
-}
+  use HTTP::Link::Parser ':all';
 
-sub parse_header
-{
-	my $hdrv = shift;
-	my $base = shift;
-	my $rv   = {};
-	
-	my $uri  = undef;
-	if ($hdrv =~ /^(\s*<([^>]*)>\s*)/)
-	{
-		$uri  = $2;
-		$hdrv = substr($hdrv, length($1));
-	}
-	else
-	{
-		return $rv;
-	}
-	
-	$rv->{'URI'} = URI->new_abs($uri, $base);
-	
-	while ($hdrv =~ /^(\s*\;\s*(\/|[a-z0-9-]+\*?)\s*\=\s*("[^"]*"|[^\s\"\;\,]+)\s*)/i)
-	{
-		$hdrv = substr($hdrv, length($1));
-		my $key = lc $2;
-		my $val = $3;
-	
-		$val =~ s/(^"|"$)//g if ($val =~ /^".*"$/);
-		
-		if ($key eq 'rel')
-		{
-			$val =~ s/(^\s+)|(\s+$)//g;
-			$val =~ s/\s+/ /g;
-			
-			my @rels = split / /, $val;
-			foreach my $rel (@rels)
-				{ push @{ $rv->{'rel'} }, $rel; }
-		}
-		elsif ($key eq 'rev')
-		{
-			$val =~ s/(^\s+)|(\s+$)//g;
-			$val =~ s/\s+/ /g;
-			
-			my @rels = split / /, $val;
-			foreach my $rel (@rels)
-				{ push @{ $rv->{'rev'} }, $rel; }
-		}
-		elsif ($key eq 'anchor')
-		{
-			$rv->{'anchor'} = URI->new_abs($val, $base)
-				unless defined $rv->{'anchor'};
-		}
-		elsif ($key eq 'title')
-		{
-			$rv->{'title'} = $val
-				unless defined $rv->{'title'};
-		}
-		elsif ($key eq 'title*')
-		{
-			my ($charset, $lang, $string) = split /\'/, $val;
-			$string = uri_unescape($string);
-			$string = decode($charset, $string);
-			my $lit = bless [$string, undef, lc $lang], 'HTTP::Link::Parser::PlainLiteral';
-			push @{ $rv->{'title*'} }, $lit;
-		}
-		elsif ($key eq 'type')
-		{
-			$rv->{'type'} = $val
-				unless defined $rv->{'type'};
-		}
-		else # hreflang, plus any extended types.
-		{
-			push @{ $rv->{ $key } }, $val;
-		}
-	}
-	
-	return $rv;
-}
+=over 4
 
-sub parse_links_to_list
-{
-	my $response = shift;
-	my $rv       = [];
-	my $base     = URI->new($response->base);
-	
-	foreach my $header ($response->header('link'))
-	{
-		push @$rv, parse_header($header, $base);
-	}
-	
-	return $rv;
-}
+=item C<< $model = parse_links_into_model($response, [$existing_model]) >>
+
+Takes an L<HTTP::Response> object (or in fact, any L<HTTP::Message> object)
+and returns an L<RDF::Trine::Model> containing link data extracted from the
+response. Dublin Core is used to encode 'hreflang', 'title' and 'type' link
+parameters.
+
+C<$existing_model> is an RDF::Trine::Model to add data to. If omitted, a
+new, empty model is created.
+
+=cut
 
 sub parse_links_into_model
 {
 	return $model;
 }
 
+=item C<< $data = parse_links_to_rdfjson($response) >>
+
+C<$data> is a hashref with a structure inspired by the RDF/JSON
+specification. This can be thought of as a shortcut for:
+
+  use RDF::Trine 0.112;
+  $model = parse_links_into_model($response);
+  $data  = $model->as_hashref;
+
+But it's faster as no intermediate model is built.
+
+=cut
+
 sub parse_links_to_rdfjson
 {
 	my $response = shift;
 	return $rv;
 }
 
+=item C<< $list = parse_links_to_list($response) >>
+
+This function is not exported by default. 
+
+C<$list> 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.
+
+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
+C<relationship_uri> function.
+
+The structure returned by this function should not be considered
+stable.
+
+=cut
+
+sub parse_links_to_list
+{
+	my $response = shift;	my $rv       = [];
+	my $base     = URI->new($response->base);
+	
+	foreach my $header ($response->header('link'))
+	{
+		push @$rv, parse_single_link($header, $base);
+	}
+	
+	return $rv;
+}
+
+=item C<< $data = parse_single_link($link, $base) >>
+
+This function is not exported by default. 
+
+This parses a single Link header (minus the "Link:" bit itself) into a hashref
+structure. A base URI must be included in case the link contains relative URIs.
+
+The structure returned by this function should not be considered
+stable.
+
+=cut
+
+sub parse_single_link
+{
+	my $hdrv = shift;
+	my $base = shift;
+	my $rv   = {};
+	
+	my $uri  = undef;
+	if ($hdrv =~ /^(\s*<([^>]*)>\s*)/)
+	{
+		$uri  = $2;
+		$hdrv = substr($hdrv, length($1));
+	}
+	else
+	{
+		return $rv;
+	}
+	
+	$rv->{'URI'} = URI->new_abs($uri, $base);
+	
+	while ($hdrv =~ /^(\s*\;\s*(\/|[a-z0-9-]+\*?)\s*\=\s*("[^"]*"|[^\s\"\;\,]+)\s*)/i)
+	{
+		$hdrv = substr($hdrv, length($1));
+		my $key = lc $2;
+		my $val = $3;
+	
+		$val =~ s/(^"|"$)//g if ($val =~ /^".*"$/);
+		
+		if ($key eq 'rel')
+		{
+			$val =~ s/(^\s+)|(\s+$)//g;
+			$val =~ s/\s+/ /g;
+			
+			my @rels = split / /, $val;
+			foreach my $rel (@rels)
+				{ push @{ $rv->{'rel'} }, $rel; }
+		}
+		elsif ($key eq 'rev')
+		{
+			$val =~ s/(^\s+)|(\s+$)//g;
+			$val =~ s/\s+/ /g;
+			
+			my @rels = split / /, $val;
+			foreach my $rel (@rels)
+				{ push @{ $rv->{'rev'} }, $rel; }
+		}
+		elsif ($key eq 'anchor')
+		{
+			$rv->{'anchor'} = URI->new_abs($val, $base)
+				unless defined $rv->{'anchor'};
+		}
+		elsif ($key eq 'title')
+		{
+			$rv->{'title'} = $val
+				unless defined $rv->{'title'};
+		}
+		elsif ($key eq 'title*')
+		{
+			my ($charset, $lang, $string) = split /\'/, $val;
+			$string = uri_unescape($string);
+			$string = decode($charset, $string);
+			my $lit = bless [$string, undef, lc $lang], 'HTTP::Link::Parser::PlainLiteral';
+			push @{ $rv->{'title*'} }, $lit;
+		}
+		elsif ($key eq 'type')
+		{
+			$rv->{'type'} = $val
+				unless defined $rv->{'type'};
+		}
+		else # hreflang, plus any extended types.
+		{
+			push @{ $rv->{ $key } }, $val;
+		}
+	}
+	
+	return $rv;
+}
+
+=item C<< $long = relationship_uri($short) >>
+
+This function is not exported by default. 
+
+It may be used to convert short strings identifying relationships,
+such as "next" and "prev", into longer URIs identifying the same
+relationships, such as "http://www.iana.org/assignments/relation/next"
+and "http://www.iana.org/assignments/relation/prev".
+
+If passed a string which is a URI already, simply returns it as-is.
+
+=cut
+
+sub relationship_uri
+{
+	my $str = shift;
+
+	if ($str =~ /^([a-z][a-z0-9\+\.\-]*)\:/i)
+	{
+		# seems to be an absolute URI, so can safely return "as is".
+		return $str;
+	}
+
+	return 'http://www.iana.org/assignments/relation/' . (lc $str);
+
+	my $url = url (lc $str), 'http://www.iana.org/assignments/relation/';
+	return $url->abs->as_string;
+
+	return undef;
+}
+
 1;
 
 package HTTP::Link::Parser::PlainLiteral;
 1;
 __END__
 
-=head1 NAME
-
-HTTP::Link::Parser - Perl extension for parsing HTTP Link headers
-
-=head1 VERSION
-
-0.04
-
-=head1 SYNOPSIS
-
-  use HTTP::Link::Parser qw(:standard);
-  use LWP::UserAgent;
-  
-  my $ua = LWP::UserAgent->new;
-  my $response = $ua->get("http://example.com/foo");
-  
-  # Parse link headers into an RDF::Trine::Model.
-  my $model = parse_links_into_model($response);
-
-  # Find data about <http://example.com/foo>.
-  my $iterator = $model->get_statements(
-    RDF::Trine::Node::Resource->new('http://example.com/foo'),
-    undef,
-    undef);
-
-  while ($statement = $iterator->next)
-  {
-     # Skip data where the value is not a resource (i.e. link)
-     next unless $statement->object->is_resource;
-
-     printf("Link to <%s> with rel=\"%s\".\n",
-        $statement->object->uri,
-        $statement->predicate->uri);
-  }
-  
-
-=head1 DESCRIPTION
-
-HTTP::Link::Parser parses HTTP "Link" headers found in an
-HTTP::Response object. Headers should conform to the format
-described in the forthcoming IETF specification.
-
-=over 8
-
-=item $model = parse_links_into_model($response, [$existing_model]);
-
-C<$model> is an RDF::Trine::Model. Dublin Core is used to encode
-'hreflang', 'title' and 'type' link parameters.
-
-=item $rdf = parse_links_to_rdfjson($response);
-
-C<$rdf> 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.
-
-This can be thought of as a shortcut for:
-
-  use RDF::Trine 0.112;
-  $model = parse_links_into_model($response);
-  $rdf   = $model->as_hashref;
-
-But it's faster as no intermediate model is built.
-
-=item $list = parse_links_to_list($response);
-
-C<$list> 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.
-
-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
-C<HTTP::Link::Parser::relationship_uri()> function.
-
-=item $long = HTTP::Link::Parser::relationship_uri($short);
-
-This function is not exported by default. It may be used to convert
-short strings identifying relationships, such as "next" and "prev",
-into longer URIs identifying the same relationships, such as
-"http://www.iana.org/assignments/relation/next" and
-"http://www.iana.org/assignments/relation/prev".
-
 =back
 
 =head1 BUGS
 
 L<http://www.mnot.net/drafts/draft-nottingham-http-link-header-07.txt>
 
-L<RDF::Trine>, L<HTTP::Response>.
+L<RDF::Trine>, L<RDF::TrineShortcuts>, L<HTTP::Response>.
 
 L<http://n2.talis.com/wiki/RDF_JSON_Specification>.
 
 
 Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
 
-=head1 COPYRIGHT AND LICENSE
+=head1 COPYRIGHT AND LICENCE
 
-Copyright (C) 2009 by Toby Inkster
+Copyright (C) 2009-2010 by Toby Inkster
+
+=head2 a.k.a. "The MIT Licence"
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
+use Test::More tests => 12;
+BEGIN { use_ok('HTTP::Link::Parser') };
+
+# Create a test response to parse.
+use HTTP::Response;
+my $response = HTTP::Response->new( 200 );
+$response->push_header("Base" => "http://example.org/subject");
+$response->push_header("Link" => "<http://example.net/absolute>; rel=\"http://example.net/rel/one http://example.net/rel/two\"; title=\"absolute\"");
+$response->push_header("Link" => "<relative>; rel=\"three\"; title=\"relative\"");
+$response->push_header("Link" => "<nextdoc>; rel=\"next\"; title=\"relative\"; type=\"TEXT/HTML\"; hreflang=en");
+$response->push_header("Link" => "<subject>; rel=\"prev\"; title=\"subject\"; anchor=\"nextdoc\"");
+$response->push_header("Link" => "<author>; rev=\"made\"; title=\"author\";");
+$response->push_header("Link" => "<german-page>; rev=\"test\"; title=\"nachstes Kapitel\"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel");
+
+my $M = HTTP::Link::Parser::parse_links_into_model($response);
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/subject'),
+		RDF::Trine::Node::Resource->new('http://example.net/rel/one'),
+		RDF::Trine::Node::Resource->new('http://example.net/absolute'),
+		),
+	"absolute relationships");
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/subject'),
+		RDF::Trine::Node::Resource->new('http://www.iana.org/assignments/relation/three'),
+		RDF::Trine::Node::Resource->new('http://example.org/relative'),
+		),
+	"relative relationships");
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/subject'),
+		RDF::Trine::Node::Resource->new('http://example.net/rel/two'),
+		RDF::Trine::Node::Resource->new('http://example.net/absolute'),
+		),
+	"space-separated relationships");
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/nextdoc'),
+		RDF::Trine::Node::Resource->new('http://www.iana.org/assignments/relation/prev'),
+		RDF::Trine::Node::Resource->new('http://example.org/subject'),
+		),
+	"the 'anchor' link parameter");
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/author'),
+		RDF::Trine::Node::Resource->new('http://www.iana.org/assignments/relation/made'),
+		RDF::Trine::Node::Resource->new('http://example.org/subject'),
+		),
+	"the 'rev' link parameter");
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/author'),
+		RDF::Trine::Node::Resource->new('http://purl.org/dc/terms/title'),
+		RDF::Trine::Node::Literal->new('author'),
+		),
+	"the 'title' link parameter");
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/subject'),
+		RDF::Trine::Node::Resource->new('http://purl.org/dc/terms/title'),
+		RDF::Trine::Node::Literal->new('subject'),
+		),
+	"the 'title' link parameter, with 'anchor'");
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/german-page'),
+		RDF::Trine::Node::Resource->new('http://purl.org/dc/terms/title'),
+		RDF::Trine::Node::Literal->new('nächstes Kapitel', 'de'),
+		),
+	"the 'title*' link parameter");
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/german-page'),
+		RDF::Trine::Node::Resource->new('http://purl.org/dc/terms/title'),
+		RDF::Trine::Node::Literal->new('nachstes Kapitel'),
+		),
+	"'title*' fallback");
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/nextdoc'),
+		RDF::Trine::Node::Resource->new('http://purl.org/dc/terms/language'),
+		RDF::Trine::Node::Resource->new('http://www.lingvoj.org/lingvo/en'),
+		),
+	"the 'hreflang' link parameter");
+
+ok($M->count_statements(
+		RDF::Trine::Node::Resource->new('http://example.org/nextdoc'),
+		RDF::Trine::Node::Resource->new('http://purl.org/dc/terms/format'),
+		RDF::Trine::Node::Resource->new('http://www.iana.org/assignments/media-types/text/html'),
+		),
+	"the 'type' link parameter");
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.