Commits

Toby Inkster committed a988b4b

general updates

  • Participants
  • Parent commits 9901271
  • Tags 0.004

Comments (0)

Files changed (5)

-use inc::Module::Package 'RDF:standard';
+use inc::Module::Package 'RDF:tobyink';
 

File lib/XML/LibXML/QuerySelector.pm

+use 5.008;
+use strict;
+use utf8;
+
 package XML::LibXML::QuerySelector;
 
-use 5.010;
-use common::sense;
-use utf8;
-
 use HTML::Selector::XPath 0.13 qw//;
 use XML::LibXML 1.70 qw//;
 
 BEGIN
 {
-	$XML::LibXML::QuerySelector::AUTHORITY = 'cpan:TOBYINK';
-	$XML::LibXML::QuerySelector::VERSION   = '0.003';
+	our $AUTHORITY = 'cpan:TOBYINK';
+	our $VERSION   = '0.004';
 	
 	push @XML::LibXML::Document::ISA, __PACKAGE__;
 	push @XML::LibXML::DocumentFragment::ISA, __PACKAGE__;
 	push @XML::LibXML::Element::ISA, __PACKAGE__;
-	
-	eval { require Object::AUTHORITY; Object::AUTHORITY->import };
-	eval { require Object::DOES;      Object::DOES->import };
 }
 
 my $contains = sub 
 {
-	my ($self, $node) = @_;
+	my $self = shift;
+	my ($node) = @_;
 	my $self_path = $self->nodePath;
 	my $node_path = $node->nodePath;
 	my $sub_node_path = substr $node_path, 0, length $self_path;
 
 sub querySelectorAll
 {
-	my ($self, $selector_string) = @_;
-	my $selector = HTML::Selector::XPath->new($selector_string);
+	my $self = shift;
+	my ($selector_string) = @_;
+	my $selector = "HTML::Selector::XPath"->new($selector_string);
 	
 	my $document = $self->nodeName =~ /^#/ ? $self : $self->ownerDocument;
 	my $nsuri    = $document->documentElement->lookupNamespaceURI('');
 	
-	my $xc = XML::LibXML::XPathContext->new($document);
+	my $xc = "XML::LibXML::XPathContext"->new($document);
 	$xc->registerNs(defaultns => $nsuri) if $nsuri;
 
 	my $xpath = defined $nsuri
 		{ $self->$contains($_) ? ($_) : () }
 		@{[ $xc->findnodes($xpath) ]};
 	
-	wantarray ? @results : XML::LibXML::NodeList->new(@results);
+	wantarray ? @results : "XML::LibXML::NodeList"->new(@results);
 }
 
 sub querySelector
 {
-	my ($self, $selector_string) = @_;
+	my $self = shift;
+	my ($selector_string) = @_;
 	my $results = $self->querySelectorAll($selector_string);
 	return unless $results->size;
 	$results->shift;
 
 =head1 SYNOPSIS
 
-  my $document = XML::LibXML->new->parse_file('my.xhtml');
+  use XML::LibXML::QuerySelector;
+  
+  my $document = XML::LibXML->load_xml(location => 'my.xhtml');
   my $warning  = $document->querySelector('p.warning strong');
   print $warning->toString if defined $warning;
 
 =head1 DESCRIPTION
 
 This module defines a class (it has no constructor so perhaps closer to an
-abstract class or a role)XML::LibXML::QuerySelector, and sets itself up as
+abstract class or a role) XML::LibXML::QuerySelector, and sets itself up as
 a superclass (not a subclass) of L<XML::LibXML::Document>,
 L<XML::LibXML::DocumentFragment> and L<XML::LibXML::Element>, thus making
 its methods available to objects of those classes.
 
 =head2 Methods
 
-The methods provided by this module are defined in the W3C Candidate
-Recomendation "Selectors API Level 1" L<http://www.w3.org/TR/selectors-api/>.
+The methods provided by this module are defined in the W3C Recomendation
+"Selectors API Level 1" L<http://www.w3.org/TR/selectors-api/>.
 
 =over
 
 =item * When called on an element, C<querySelectorAll> returns a static
 node list; not a live node list. (Called on a document or document
 fragment, it will return a live node list as specified in the W3C
-Candidate Recommendation.)
+Recommendation.)
 
 =item * Use on mixed-namespace documents is largely untested. The module
 is mostly intended for use with XHTML and HTML documents.
 L<HTML::Selector::XPath>,
 L<XML::LibXML>.
 
+L<http://www.w3.org/TR/selectors-api/>.
+
 =head1 AUTHOR
 
 Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
 
 =head1 THANKS
 
-Tatsuhiko Miyagawa and Max Maischein, for HTML::Selector::XPath, and for
+Tatsuhiko Miyagawa and Max Maischein, for L<HTML::Selector::XPath>, and for
 resolving L<https://rt.cpan.org/Ticket/Display.html?id=73719> quickly.
 
 =head1 COPYRIGHT AND LICENCE
 
-This software is copyright (c) 2012 by Toby Inkster.
+This software is copyright (c) 2012-2013 by Toby Inkster.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.

File meta/changes.pret

+
+`XML-LibXML-QuerySelector 0.001 cpan:TOBYINK`
+	issued     2012-01-05;
+	label      "Initial release".
+
+`XML-LibXML-QuerySelector 0.002 cpan:TOBYINK`
+	issued     2012-01-07;
+	changeset [
+		item "Remove spurious 'use Data::Printer' from t/02level1.t"^^Packaging;
+	].
+
+`XML-LibXML-QuerySelector 0.003 cpan:TOBYINK`
+	issued     2012-01-17;
+	changeset [
+		item "Dropped XML::LibXML::QuerySelector::ToXPath, which was a bundled and modified version of HTML::Selector::XPath."^^Removal;
+		item "use HTML::Selector::XPath 0.13"^^Update;
+	] .
+
+`XML-LibXML-QuerySelector 0.004 cpan:TOBYINK`
+	issued     2013-03-01;
+	changeset [
+		item "General cleanup."^^Update;
+		item "Drop common::sense dependency."^^Packaging;
+		item "No longer refer the the spec as a 'Candidate Recommendation'; it's a 'Recommendation' now."^^Update;
+	] .

File meta/changes.ttl

-# This file acts as the project's changelog.
-
-@prefix :        <http://usefulinc.com/ns/doap#> .
-@prefix dcs:     <http://ontologi.es/doap-changeset#> .
-@prefix dc:      <http://purl.org/dc/terms/> .
-@prefix dist:    <http://purl.org/NET/cpan-uri/dist/XML-LibXML-QuerySelector/> .
-@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
-
-dist:project :release dist:v_0-001 .
-dist:v_0-001
-	a               :Version ;
-	dc:issued       "2012-01-05"^^xsd:date ;
-	:revision       "0.001"^^xsd:string ;
-	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/XML-LibXML-QuerySelector-0.001.tar.gz> ;
-	rdfs:label      "Initial release" .
-
-dist:project :release dist:v_0-002 .
-dist:v_0-002
-	a               :Version ;
-	dc:issued       "2012-01-07"^^xsd:date ;
-	:revision       "0.002"^^xsd:string ;
-	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/XML-LibXML-QuerySelector-0.002.tar.gz> ;
-	dcs:changeset [
-		dcs:versus dist:v_0-001 ;
-		dcs:item   [ rdfs:label "Remove spurious 'use Data::Printer' from t/02level1.t"@en ; a dcs:Packaging ]
-		] .
-
-dist:project :release dist:v_0-003 .
-dist:v_0-003
-	a               :Version ;
-	dc:issued       "2012-01-17"^^xsd:date ;
-	:revision       "0.003"^^xsd:string ;
-	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/XML-LibXML-QuerySelector-0.003.tar.gz> ;
-	dcs:changeset [
-		dcs:versus dist:v_0-002 ;
-		dcs:item   [ rdfs:label "Dropped XML::LibXML::QuerySelector::ToXPath, which was a bundled and modified version of HTML::Selector::XPath."@en; a dcs:Removal ];
-		dcs:item   [ rdfs:label "use HTML::Selector::XPath 0.13"@en ]
-		] .

File meta/makefile.ttl

 	:perl_version_from _:main ;
 	:version_from _:main ;
 	:readme_from _:main ;
-	:test_requires "Test::More 0.61" ;
-	:requires "Carp", "HTML::Selector::XPath 0.13", "XML::LibXML 1.70" , "common::sense" , "utf8" .
+	:requires "HTML::Selector::XPath 0.13", "XML::LibXML 1.70".
 
 _:main <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName> "lib/XML/LibXML/QuerySelector.pm" .